Package org.apache.commons.dbcp
Class PoolableCallableStatement
- java.lang.Object
-
- org.apache.commons.dbcp.AbandonedTrace
-
- org.apache.commons.dbcp.DelegatingStatement
-
- org.apache.commons.dbcp.DelegatingPreparedStatement
-
- org.apache.commons.dbcp.DelegatingCallableStatement
-
- org.apache.commons.dbcp.PoolableCallableStatement
-
- All Implemented Interfaces:
java.lang.AutoCloseable,java.sql.CallableStatement,java.sql.PreparedStatement,java.sql.Statement,java.sql.Wrapper
public class PoolableCallableStatement extends DelegatingCallableStatement implements java.sql.CallableStatement
ADelegatingCallableStatementthat cooperates withPoolingConnectionto implement a pool ofCallableStatements.The
close()method returns this statement to its containing pool. (SeePoolingConnection.)- Since:
- 1.3
- Version:
- $Revision: 883040 $ $Date: 2009-11-22 01:01:20 -0500 (Sun, 22 Nov 2009) $
- See Also:
PoolingConnection
-
-
Field Summary
-
Fields inherited from class org.apache.commons.dbcp.DelegatingStatement
_closed, _conn, _stmt
-
-
Constructor Summary
Constructors Constructor Description PoolableCallableStatement(java.sql.CallableStatement stmt, java.lang.Object key, org.apache.commons.pool.KeyedObjectPool pool, java.sql.Connection conn)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidactivate()Activates after retrieval from the pool.voidclose()Returns the CallableStatement to the pool.<T> TgetObject(int columnIndex, java.lang.Class<T> type)<T> TgetObject(java.lang.String columnLabel, java.lang.Class<T> type)protected voidpassivate()Passivates to prepare for return to the pool.-
Methods inherited from class org.apache.commons.dbcp.DelegatingCallableStatement
equals, getArray, getArray, getBigDecimal, getBigDecimal, getBigDecimal, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getDate, getDate, getDate, getDate, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getObject, getRef, getRef, getRowId, getRowId, getShort, getShort, getSQLXML, getSQLXML, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getURL, getURL, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, 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, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setURL, wasNull
-
Methods inherited from class org.apache.commons.dbcp.DelegatingPreparedStatement
addBatch, clearParameters, closeOnCompletion, execute, executeQuery, executeUpdate, getMetaData, getParameterMetaData, isCloseOnCompletion, 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
-
Methods inherited from class org.apache.commons.dbcp.DelegatingStatement
addBatch, cancel, checkOpen, clearBatch, 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
-
Methods inherited from class org.apache.commons.dbcp.AbandonedTrace
addTrace, clearTrace, getConfig, getLastUsed, getTrace, printStackTrace, removeTrace, setLastUsed, setLastUsed, setStackTrace
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.sql.CallableStatement
getArray, getArray, getBigDecimal, getBigDecimal, getBigDecimal, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getDate, getDate, getDate, getDate, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getObject, getRef, getRef, getRowId, getRowId, getShort, getShort, getSQLXML, getSQLXML, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getURL, getURL, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, 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, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setURL, wasNull
-
Methods inherited from interface java.sql.PreparedStatement
addBatch, 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
-
Methods inherited from interface java.sql.Statement
addBatch, cancel, clearBatch, clearWarnings, closeOnCompletion, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, 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, isCloseOnCompletion, isPoolable, isSimpleIdentifier, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
-
-
-
-
Constructor Detail
-
PoolableCallableStatement
public PoolableCallableStatement(java.sql.CallableStatement stmt, java.lang.Object key, org.apache.commons.pool.KeyedObjectPool pool, java.sql.Connection conn)Constructor.- Parameters:
stmt- the underlyingCallableStatementkey- the key for this statement in theKeyedObjectPoolpool- theKeyedObjectPoolfrom which this CallableStatement was obtainedconn- theConnectionthat created this CallableStatement
-
-
Method Detail
-
close
public void close() throws java.sql.SQLExceptionReturns the CallableStatement to the pool. If {DelegatingStatement.isClosed(), this is a No-op.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.sql.Statement- Overrides:
closein classDelegatingStatement- Throws:
java.sql.SQLException
-
activate
protected void activate() throws java.sql.SQLExceptionActivates after retrieval from the pool. Adds a trace for this CallableStatement to the Connection that created it.- Overrides:
activatein classDelegatingStatement- Throws:
java.sql.SQLException
-
passivate
protected void passivate() throws java.sql.SQLExceptionPassivates to prepare for return to the pool. Removes the trace associated with this CallableStatement from the Connection that created it. Also closes any associated ResultSets.- Overrides:
passivatein classDelegatingStatement- Throws:
java.sql.SQLException
-
getObject
public <T> T getObject(java.lang.String columnLabel, java.lang.Class<T> type) throws java.sql.SQLException- Specified by:
getObjectin interfacejava.sql.CallableStatement- Overrides:
getObjectin classDelegatingCallableStatement- Throws:
java.sql.SQLException
-
getObject
public <T> T getObject(int columnIndex, java.lang.Class<T> type) throws java.sql.SQLException- Specified by:
getObjectin interfacejava.sql.CallableStatement- Overrides:
getObjectin classDelegatingCallableStatement- Throws:
java.sql.SQLException
-
-