Package org.jboss.jca.adapters.jdbc
Class BaseWrapperManagedConnection
java.lang.Object
org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection
- All Implemented Interfaces:
javax.resource.spi.ManagedConnection,org.jboss.jca.core.connectionmanager.pool.mcp.NotifyingManagedConnection,ConnectableResource
- Direct Known Subclasses:
LocalManagedConnection,XAManagedConnection
public abstract class BaseWrapperManagedConnection
extends Object
implements org.jboss.jca.core.connectionmanager.pool.mcp.NotifyingManagedConnection, ConnectableResource
BaseWrapperManagedConnection
- Author:
- David Jencks, Adrian Brock, Weston Price, Jesper Pedersen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static AdaptersBundleThe bundleprotected final ConnectionThe connectionprotected booleanDestroyedprotected static booleanIgnore in managed auto commit callsprotected AtomicBooleanIs inside a local transactionprotected booleanIs inside a managed transactionprotected booleanJDBC auto-commitprotected booleanJDBC read-onlyprotected intJDBC transaction isolationprotected final BaseWrapperManagedConnectionFactoryThe managed connection factoryprotected javax.resource.spi.ManagedConnectionMetaDataMetadataprotected PropertiesThe propertiesprotected static booleanprotected final ObjectThe state lockprotected booleanUnderlying auto-commitprotected booleanUnderlying read-only -
Constructor Summary
ConstructorsConstructorDescriptionBaseWrapperManagedConnection(BaseWrapperManagedConnectionFactory mcf, Connection con, Properties props, int transactionIsolation, int psCacheSize) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConnectionEventListener(javax.resource.spi.ConnectionEventListener cel) Add a connection event listenervoidassociateConnection(Object handle) Associate a handleprotected voidBroad cast a connection errorprotected voidCheck exceptionprotected voidCheck statevoidcleanup()voiddestroy()Destroyprotected Optional<MethodHandle>getConnection(Subject subject, javax.resource.spi.ConnectionRequestInfo cri) Get a connectionprotected Optional<MethodHandle>protected AdaptersLoggergetLog()Get the loggerjavax.resource.spi.ManagedConnectionMetaDataGet the propertiesabstract booleanisXA()Returns true if the underlying connection is handled by an XA resource managerprotected voidlock()LockvoidvoidvoidremoveConnectionEventListener(javax.resource.spi.ConnectionEventListener cel) Remove a connection event listenerprotected voidsetBeginRequestNotify(Optional<MethodHandle> beginRequest) voidprotected voidsetEndRequestNotify(Optional<MethodHandle> endRequest) voidsetLogWriter(PrintWriter param1) protected voidtryLock()Try lockprotected voidunlock()UnlockMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.resource.spi.ManagedConnection
getLocalTransaction, getXAResource
-
Field Details
-
bundle
The bundle -
mcf
The managed connection factory -
con
The connection -
props
The properties -
stateLock
The state lock -
inManagedTransaction
protected boolean inManagedTransactionIs inside a managed transaction -
inLocalTransaction
Is inside a local transaction -
jdbcAutoCommit
protected boolean jdbcAutoCommitJDBC auto-commit -
ignoreInManagedAutoCommitCalls
protected static boolean ignoreInManagedAutoCommitCallsIgnore in managed auto commit calls -
setAutoCommitOnCleanup
protected static boolean setAutoCommitOnCleanup -
underlyingAutoCommit
protected boolean underlyingAutoCommitUnderlying auto-commit -
jdbcReadOnly
protected boolean jdbcReadOnlyJDBC read-only -
underlyingReadOnly
protected boolean underlyingReadOnlyUnderlying read-only -
jdbcTransactionIsolation
protected int jdbcTransactionIsolationJDBC transaction isolation -
destroyed
protected boolean destroyedDestroyed -
metadata
protected javax.resource.spi.ManagedConnectionMetaData metadataMetadata
-
-
Constructor Details
-
BaseWrapperManagedConnection
public BaseWrapperManagedConnection(BaseWrapperManagedConnectionFactory mcf, Connection con, Properties props, int transactionIsolation, int psCacheSize) throws SQLException Constructor- Parameters:
mcf- The managed connection factorycon- The connectionprops- The propertiestransactionIsolation- The transaction isolationpsCacheSize- The prepared statement cache size- Throws:
SQLException- Thrown if an error occurs
-
-
Method Details
-
addConnectionEventListener
public void addConnectionEventListener(javax.resource.spi.ConnectionEventListener cel) Add a connection event listener- Specified by:
addConnectionEventListenerin interfacejavax.resource.spi.ManagedConnection- Parameters:
cel- The listener
-
removeConnectionEventListener
public void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener cel) Remove a connection event listener- Specified by:
removeConnectionEventListenerin interfacejavax.resource.spi.ManagedConnection- Parameters:
cel- The listener
-
associateConnection
Associate a handle- Specified by:
associateConnectionin interfacejavax.resource.spi.ManagedConnection- Parameters:
handle- The handle- Throws:
javax.resource.ResourceException- Thrown if an error occurs
-
getLogWriter
- Specified by:
getLogWriterin interfacejavax.resource.spi.ManagedConnection- Throws:
javax.resource.ResourceException
-
getMetaData
public javax.resource.spi.ManagedConnectionMetaData getMetaData() throws javax.resource.ResourceException- Specified by:
getMetaDatain interfacejavax.resource.spi.ManagedConnection- Throws:
javax.resource.ResourceException
-
setLogWriter
- Specified by:
setLogWriterin interfacejavax.resource.spi.ManagedConnection- Throws:
javax.resource.ResourceException
-
cleanup
public void cleanup() throws javax.resource.ResourceException- Specified by:
cleanupin interfacejavax.resource.spi.ManagedConnection- Throws:
javax.resource.ResourceException
-
lock
protected void lock()Lock -
tryLock
Try lock- Throws:
SQLException- Thrown if a lock can't be obtained
-
unlock
protected void unlock()Unlock -
getConnection
public Object getConnection(Subject subject, javax.resource.spi.ConnectionRequestInfo cri) throws javax.resource.ResourceException Get a connection- Specified by:
getConnectionin interfacejavax.resource.spi.ManagedConnection- Parameters:
subject- The subjectcri- The connection request info- Returns:
- The connection
- Throws:
javax.resource.ResourceException- Thrown if an error occurs
-
destroy
public void destroy() throws javax.resource.ResourceExceptionDestroy- Specified by:
destroyin interfacejavax.resource.spi.ManagedConnection- Throws:
javax.resource.ResourceException- Thrown if an error occurs
-
getProperties
Get the properties- Returns:
- The value
-
getConnection
- Specified by:
getConnectionin interfaceConnectableResource- Throws:
Exception
-
setConnectableResourceListener
- Specified by:
setConnectableResourceListenerin interfaceConnectableResource
-
broadcastConnectionError
Broad cast a connection error- Parameters:
e- The error
-
getLog
Get the logger- Returns:
- The value
-
checkState
Check state- Throws:
SQLException- Thrown if an error occurs
-
checkException
Check exception- Parameters:
e- The exception- Throws:
javax.resource.ResourceException- Thrown if an error occurs
-
getEndRequestNotify
-
setEndRequestNotify
-
getBeginRequestNotify
-
setBeginRequestNotify
-
isXA
public abstract boolean isXA()Returns true if the underlying connection is handled by an XA resource manager- Returns:
- The value
-
notifyRequestBegin
public void notifyRequestBegin()- Specified by:
notifyRequestBeginin interfaceorg.jboss.jca.core.connectionmanager.pool.mcp.NotifyingManagedConnection
-
notifyRequestEnd
public void notifyRequestEnd()- Specified by:
notifyRequestEndin interfaceorg.jboss.jca.core.connectionmanager.pool.mcp.NotifyingManagedConnection
-