Package org.apache.openjpa.jdbc.kernel
Class JDBCStoreManager.RefCountConnection
- java.lang.Object
-
- org.apache.openjpa.lib.jdbc.DelegatingConnection
-
- org.apache.openjpa.jdbc.kernel.JDBCStoreManager.RefCountConnection
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,java.sql.Connection
,java.sql.Wrapper
,Closeable
- Enclosing class:
- JDBCStoreManager
protected class JDBCStoreManager.RefCountConnection extends DelegatingConnection
Connection wrapper that keeps an internal ref count so that it knows when to really close.
-
-
Constructor Summary
Constructors Constructor Description RefCountConnection(java.sql.Connection conn)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected java.sql.Statement
createStatement(boolean wrap)
Create a statement, with the option of not wrapping it in aDelegatingStatement
, which is the default.protected java.sql.Statement
createStatement(int rsType, int rsConcur, boolean wrap)
Create a statement, with the option of not wrapping it in aDelegatingStatement
, which is the default.void
free()
boolean
getRetain()
protected java.sql.PreparedStatement
prepareStatement(java.lang.String sql, boolean wrap)
Prepare a statement, with the option of not wrapping it in aDelegatingPreparedStatement
, which is the default.protected java.sql.PreparedStatement
prepareStatement(java.lang.String sql, int rsType, int rsConcur, boolean wrap)
Prepare a statement, with the option of not wrapping it in aDelegatingPreparedStatement
, which is the default.void
ref()
void
setRetain(boolean retain)
-
Methods inherited from class org.apache.openjpa.lib.jdbc.DelegatingConnection
abort, appendInfo, clearWarnings, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStatement, createStruct, equals, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getDelegate, getHoldability, getInnermostDelegate, getMetaData, getMetaData, getNetworkTimeout, getSchema, getTransactionIsolation, getTypeMap, getWarnings, hashCode, isClosed, isReadOnly, isValid, isWrapperFor, nativeSQL, prepareCall, prepareCall, prepareCall, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setHoldability, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setSchema, setTransactionIsolation, setTypeMap, toString, unwrap
-
-
-
-
Method Detail
-
getRetain
public boolean getRetain()
-
setRetain
public void setRetain(boolean retain)
-
ref
public void ref()
-
close
public void close() throws java.sql.SQLException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfacejava.sql.Connection
- Overrides:
close
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
free
public void free()
-
createStatement
protected java.sql.Statement createStatement(boolean wrap) throws java.sql.SQLException
Description copied from class:DelegatingConnection
Create a statement, with the option of not wrapping it in aDelegatingStatement
, which is the default.- Overrides:
createStatement
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
createStatement
protected java.sql.Statement createStatement(int rsType, int rsConcur, boolean wrap) throws java.sql.SQLException
Description copied from class:DelegatingConnection
Create a statement, with the option of not wrapping it in aDelegatingStatement
, which is the default.- Overrides:
createStatement
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
prepareStatement
protected java.sql.PreparedStatement prepareStatement(java.lang.String sql, boolean wrap) throws java.sql.SQLException
Description copied from class:DelegatingConnection
Prepare a statement, with the option of not wrapping it in aDelegatingPreparedStatement
, which is the default.- Overrides:
prepareStatement
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
prepareStatement
protected java.sql.PreparedStatement prepareStatement(java.lang.String sql, int rsType, int rsConcur, boolean wrap) throws java.sql.SQLException
Description copied from class:DelegatingConnection
Prepare a statement, with the option of not wrapping it in aDelegatingPreparedStatement
, which is the default.- Overrides:
prepareStatement
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
-