Class PoolingDriver.PoolGuardConnectionWrapper
- java.lang.Object
-
- org.datanucleus.store.rdbms.datasource.dbcp2.AbandonedTrace
-
- org.datanucleus.store.rdbms.datasource.dbcp2.DelegatingConnection<java.sql.Connection>
-
- org.datanucleus.store.rdbms.datasource.dbcp2.PoolingDriver.PoolGuardConnectionWrapper
-
- All Implemented Interfaces:
java.lang.AutoCloseable,java.sql.Connection,java.sql.Wrapper,TrackedUse
- Enclosing class:
- PoolingDriver
private class PoolingDriver.PoolGuardConnectionWrapper extends DelegatingConnection<java.sql.Connection>
PoolGuardConnectionWrapper is a Connection wrapper that makes sure a closed connection cannot be used anymore.- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description private ObjectPool<? extends java.sql.Connection>pool
-
Constructor Summary
Constructors Constructor Description PoolGuardConnectionWrapper(ObjectPool<? extends java.sql.Connection> pool, java.sql.Connection delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.sql.ConnectiongetDelegate()Returns my underlyingConnection.java.sql.ConnectiongetInnermostDelegate()If my underlyingConnectionis not aDelegatingConnection, returns it, otherwise recursively invokes this method on my delegate.-
Methods inherited from class org.datanucleus.store.rdbms.datasource.dbcp2.DelegatingConnection
abort, activate, checkOpen, clearCachedState, clearWarnings, close, 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, isClosed, 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
-
-
-
-
Field Detail
-
pool
private final ObjectPool<? extends java.sql.Connection> pool
-
-
Constructor Detail
-
PoolGuardConnectionWrapper
PoolGuardConnectionWrapper(ObjectPool<? extends java.sql.Connection> pool, java.sql.Connection delegate)
-
-
Method Detail
-
getDelegate
public java.sql.Connection getDelegate()
Description copied from class:DelegatingConnectionReturns my underlyingConnection.- Overrides:
getDelegatein classDelegatingConnection<java.sql.Connection>- Returns:
- my underlying
Connection. - See Also:
DelegatingConnection.getDelegate()
-
getInnermostDelegate
public java.sql.Connection getInnermostDelegate()
Description copied from class:DelegatingConnectionIf my underlyingConnectionis 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, ornullwhen no non-DelegatingConnectiondelegate can be found by traversing this chain.This method is useful when you may have nested
DelegatingConnections, and you want to make sure to obtain a "genuine"Connection.- Overrides:
getInnermostDelegatein classDelegatingConnection<java.sql.Connection>- Returns:
- innermost delegate.
- See Also:
DelegatingConnection.getInnermostDelegate()
-
-