Class PoolingDataSource.PoolGuardConnectionWrapper<D extends java.sql.Connection>
- java.lang.Object
-
- org.datanucleus.store.rdbms.datasource.dbcp2.AbandonedTrace
-
- org.datanucleus.store.rdbms.datasource.dbcp2.DelegatingConnection<D>
-
- org.datanucleus.store.rdbms.datasource.dbcp2.PoolingDataSource.PoolGuardConnectionWrapper<D>
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,java.sql.Connection
,java.sql.Wrapper
,TrackedUse
- Enclosing class:
- PoolingDataSource<C extends java.sql.Connection>
private class PoolingDataSource.PoolGuardConnectionWrapper<D extends java.sql.Connection> extends DelegatingConnection<D>
PoolGuardConnectionWrapper is a Connection wrapper that makes sure a closed connection cannot be used anymore.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description PoolGuardConnectionWrapper(D delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the underlying connection, and close any Statements that were not explicitly closed.D
getDelegate()
Returns my underlyingConnection
.java.sql.Connection
getInnermostDelegate()
If my underlyingConnection
is not aDelegatingConnection
, returns it, otherwise recursively invokes this method on my delegate.boolean
isClosed()
-
Methods inherited from class org.datanucleus.store.rdbms.datasource.dbcp2.DelegatingConnection
abort, activate, checkOpen, clearCachedState, clearWarnings, closeInternal, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, getAutoCommit, getCacheState, getCatalog, getClientInfo, getClientInfo, getDefaultQueryTimeout, getDelegateInternal, getHoldability, getInnermostDelegateInternal, getMetaData, getNetworkTimeout, getSchema, getTransactionIsolation, getTypeMap, getWarnings, handleException, handleExceptionNoThrow, innermostDelegateEquals, isClosedInternal, isReadOnly, isValid, isWrapperFor, nativeSQL, passivate, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCacheState, setCatalog, setClientInfo, setClientInfo, setClosedInternal, setDefaultQueryTimeout, setDelegate, setHoldability, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setSchema, setTransactionIsolation, setTypeMap, toString, unwrap
-
Methods inherited from class org.datanucleus.store.rdbms.datasource.dbcp2.AbandonedTrace
addTrace, clearTrace, getLastUsed, getTrace, removeThisTrace, removeTrace, setLastUsed, setLastUsed
-
-
-
-
Constructor Detail
-
PoolGuardConnectionWrapper
PoolGuardConnectionWrapper(D delegate)
-
-
Method Detail
-
getDelegate
public D getDelegate()
Description copied from class:DelegatingConnection
Returns my underlyingConnection
.- Overrides:
getDelegate
in classDelegatingConnection<D extends java.sql.Connection>
- Returns:
- my underlying
Connection
. - See Also:
DelegatingConnection.getDelegate()
-
getInnermostDelegate
public java.sql.Connection getInnermostDelegate()
Description copied from class:DelegatingConnection
If my underlyingConnection
is not aDelegatingConnection
, returns it, otherwise recursively invokes this method on my delegate.Hence this method will return the first delegate that is not a
DelegatingConnection
, ornull
when no non-DelegatingConnection
delegate can be found by traversing this chain.This method is useful when you may have nested
DelegatingConnection
s, and you want to make sure to obtain a "genuine"Connection
.- Overrides:
getInnermostDelegate
in classDelegatingConnection<D extends java.sql.Connection>
- Returns:
- innermost delegate.
- See Also:
DelegatingConnection.getInnermostDelegate()
-
close
public void close() throws java.sql.SQLException
Description copied from class:DelegatingConnection
Closes the underlying connection, and close any Statements that were not explicitly closed. Sub-classes that override this method must:- Call passivate()
- Call close (or the equivalent appropriate action) on the wrapped connection
- Set _closed to
false
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.sql.Connection
- Overrides:
close
in classDelegatingConnection<D extends java.sql.Connection>
- Throws:
java.sql.SQLException
-
isClosed
public boolean isClosed() throws java.sql.SQLException
- Specified by:
isClosed
in interfacejava.sql.Connection
- Overrides:
isClosed
in classDelegatingConnection<D extends java.sql.Connection>
- Throws:
java.sql.SQLException
-
-