public class PoolablePreparedStatement extends DelegatingPreparedStatement implements java.sql.PreparedStatement
DelegatingPreparedStatement
that cooperates with
PoolingConnection
to implement a pool of PreparedStatement
s.
My close()
method returns me to my containing pool. (See PoolingConnection
.)
PoolingConnection
AbandonedTrace.AbandonedObjectException
Modifier and Type | Field and Description |
---|---|
protected java.lang.Object |
_key
My "key" as used by
KeyedObjectPool . |
protected org.apache.commons.pool.KeyedObjectPool |
_pool
The
KeyedObjectPool from which I was obtained. |
private boolean |
batchAdded |
_closed, _conn, _stmt
Constructor and Description |
---|
PoolablePreparedStatement(java.sql.PreparedStatement stmt,
java.lang.Object key,
org.apache.commons.pool.KeyedObjectPool pool,
java.sql.Connection conn)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
activate() |
void |
addBatch()
Add batch.
|
void |
clearBatch()
Clear Batch.
|
void |
close()
Return me to my pool.
|
void |
closeOnCompletion() |
boolean |
isCloseOnCompletion() |
protected void |
passivate() |
clearParameters, equals, execute, executeQuery, executeUpdate, getMetaData, getParameterMetaData, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setDate, setDate, setDelegate, setDouble, setFloat, setInt, setLong, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setNull, setObject, setObject, setObject, setRef, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURL, toString
addBatch, cancel, checkOpen, clearWarnings, execute, execute, execute, execute, executeBatch, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getDelegate, getFetchDirection, getFetchSize, getGeneratedKeys, getInnermostDelegate, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, handleException, hashCode, isClosed, isPoolable, isWrapperFor, setCursorName, setDelegate, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout, unwrap
addTrace, clearTrace, getConfig, getLastUsed, getTrace, printStackTrace, removeTrace, setLastUsed, setLastUsed, setStackTrace
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
clearParameters, execute, executeLargeUpdate, executeQuery, executeUpdate, getMetaData, getParameterMetaData, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setDate, setDate, setDouble, setFloat, setInt, setLong, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setNull, setObject, setObject, setObject, setObject, setObject, setRef, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURL
addBatch, cancel, clearWarnings, execute, execute, execute, execute, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isPoolable, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
protected org.apache.commons.pool.KeyedObjectPool _pool
KeyedObjectPool
from which I was obtained.protected java.lang.Object _key
KeyedObjectPool
.private volatile boolean batchAdded
public PoolablePreparedStatement(java.sql.PreparedStatement stmt, java.lang.Object key, org.apache.commons.pool.KeyedObjectPool pool, java.sql.Connection conn)
stmt
- my underlying PreparedStatement
key
- my key" as used by KeyedObjectPool
pool
- the KeyedObjectPool
from which I was obtained.conn
- the Connection
from which I was createdpublic void addBatch() throws java.sql.SQLException
addBatch
in interface java.sql.PreparedStatement
addBatch
in class DelegatingPreparedStatement
java.sql.SQLException
public void clearBatch() throws java.sql.SQLException
clearBatch
in interface java.sql.Statement
clearBatch
in class DelegatingStatement
java.sql.SQLException
public void close() throws java.sql.SQLException
close
in interface java.lang.AutoCloseable
close
in interface java.sql.Statement
close
in class DelegatingStatement
java.sql.SQLException
protected void activate() throws java.sql.SQLException
activate
in class DelegatingStatement
java.sql.SQLException
protected void passivate() throws java.sql.SQLException
passivate
in class DelegatingStatement
java.sql.SQLException
public boolean isCloseOnCompletion() throws java.sql.SQLException
isCloseOnCompletion
in interface java.sql.Statement
isCloseOnCompletion
in class DelegatingPreparedStatement
java.sql.SQLException
public void closeOnCompletion() throws java.sql.SQLException
closeOnCompletion
in interface java.sql.Statement
closeOnCompletion
in class DelegatingPreparedStatement
java.sql.SQLException