
public abstract class AbstractConnectionListener extends java.lang.Object implements ConnectionListener, org.jboss.jca.core.spi.transaction.ConnectableResourceListener
ConnectionListener interface
contract.| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.CopyOnWriteArraySet<java.lang.Object> |
connectionHandles
Connection handles
|
protected java.util.Map<java.lang.Object,java.lang.Exception> |
connectionTraces
Connection traces
|
protected java.lang.Boolean |
tracking
Tracking
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractConnectionListener(ConnectionManager cm,
javax.resource.spi.ManagedConnection managedConnection,
Pool pool,
ManagedConnectionPool mcp,
org.jboss.jca.common.api.metadata.common.FlushStrategy flushStrategy,
java.lang.Boolean tracking)
Creates a new instance of the listener that is responsible for
tracking the owned connection instance.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(java.lang.Object o)
Compare
|
void |
connectionClosed(javax.resource.spi.ConnectionEvent event) |
void |
connectionErrorOccurred(javax.resource.spi.ConnectionEvent event) |
boolean |
controls(javax.resource.spi.ManagedConnection mc,
java.lang.Object connection)
Controls the managed connection / connection pair
|
boolean |
delist()
Delist the managed connection
|
void |
destroy()
Destroys this connection listener and its managed connection.
|
void |
dissociate()
Dissociate the connection listener
|
void |
enlist()
Enlist the managed connection
|
protected org.jboss.jca.core.api.connectionmanager.ccm.CachedConnectionManager |
getCachedConnectionManager()
Gets cached connection manager
|
protected ConnectionManager |
getConnectionManager()
Gets connection manager.
|
java.lang.Exception |
getException()
Get exception
|
long |
getLastCheckedOutTime()
Retrieve the last time this connection was obtained from the pool
|
long |
getLastReturnedTime()
Retrieve the last time this connection was returned to the pool
|
long |
getLastValidatedTime()
Retrieve the last time this connection was validated.
|
protected abstract CoreLogger |
getLogger()
Get the logger
|
javax.resource.spi.ManagedConnection |
getManagedConnection()
Retrieve the managed connection for this listener.
|
ManagedConnectionPool |
getManagedConnectionPool()
Get the managed connection pool
|
int |
getNumberOfConnections()
Get number of connection handles
|
Pool |
getPool()
Retrieve the pool for this listener.
|
ConnectionState |
getState()
Retrieve the state of this connection.
|
void |
handleClosed(java.lang.Object h)
Handle closed
|
void |
handleCreated(java.lang.Object h)
Handle created
|
boolean |
isEnlisted()
Is enlisted
|
boolean |
isManagedConnectionFree()
Is the managed connection free?
|
boolean |
isTimedOut(long timeout)
Has the connection timed out?
|
boolean |
isTrackByTx()
Get whether the listener is track by transaction
|
void |
localTransactionCommitted(javax.resource.spi.ConnectionEvent event) |
void |
localTransactionRolledback(javax.resource.spi.ConnectionEvent event) |
void |
localTransactionStarted(javax.resource.spi.ConnectionEvent event) |
void |
registerConnection(java.lang.Object handle)
Register a new connection
|
void |
setLastCheckedOutTime(long v)
Set the last time this connection was obtained from the pool
|
void |
setLastValidatedTime(long lastValidated)
Set the last time, in milliseconds, that this connection was validated.
|
void |
setState(ConnectionState newState)
Set the state of this connection.
|
void |
setTrackByTx(boolean trackByTx)
Set whether the listener is track by transaction
|
boolean |
supportsLazyAssociation()
Supports lazy association
|
boolean |
supportsLazyEnlistment()
Supports lazy enlistment
|
void |
tidyup()
Tidyup
Invoked just before returning the connection to the pool when the
connection is not being destroyed.
|
void |
toPool()
Mark the connection as in pool
|
java.lang.String |
toString() |
protected void |
toString(java.lang.StringBuffer buffer)
Add specific properties.
|
void |
unregisterConnection(java.lang.Object handle)
Unregister a connection
|
void |
unregisterConnections()
Unregister connections.
|
protected java.util.concurrent.CopyOnWriteArraySet<java.lang.Object> connectionHandles
protected java.util.Map<java.lang.Object,java.lang.Exception> connectionTraces
protected java.lang.Boolean tracking
protected AbstractConnectionListener(ConnectionManager cm, javax.resource.spi.ManagedConnection managedConnection, Pool pool, ManagedConnectionPool mcp, org.jboss.jca.common.api.metadata.common.FlushStrategy flushStrategy, java.lang.Boolean tracking)
cm - connection managermanagedConnection - managed connectionpool - poolmcp - managed connection poolflushStrategy - flushStrategytracking - trackingprotected org.jboss.jca.core.api.connectionmanager.ccm.CachedConnectionManager getCachedConnectionManager()
protected ConnectionManager getConnectionManager()
protected abstract CoreLogger getLogger()
public int getNumberOfConnections()
public boolean isEnlisted()
public boolean delist()
throws javax.resource.ResourceException
True if the listener was delisted succesfully, otherwise falsejavax.resource.ResourceException - if exception occurspublic void enlist()
throws javax.transaction.SystemException
javax.transaction.SystemException - for errorspublic ManagedConnectionPool getManagedConnectionPool()
public long getLastValidatedTime()
public long getLastReturnedTime()
public long getLastCheckedOutTime()
public void setLastCheckedOutTime(long v)
v - The valuepublic javax.resource.spi.ManagedConnection getManagedConnection()
getManagedConnection in interface org.jboss.jca.core.api.connectionmanager.listener.ConnectionListenerpublic Pool getPool()
public ConnectionState getState()
public boolean isManagedConnectionFree()
public boolean isTimedOut(long timeout)
timeout - the timeoutpublic boolean isTrackByTx()
public void registerConnection(java.lang.Object handle)
handle - the connection handlepublic void setLastValidatedTime(long lastValidated)
lastValidated - the last time the connection was validated in
milliseconds.public void setState(ConnectionState newState)
newState - new statepublic void setTrackByTx(boolean trackByTx)
trackByTx - true for track by transaction, false otherwisepublic void tidyup()
throws javax.resource.ResourceException
Invoked just before returning the connection to the pool when the connection is not being destroyed.
javax.resource.ResourceException - for any errorpublic void unregisterConnection(java.lang.Object handle)
handle - the connection handlepublic void unregisterConnections()
public void toPool()
public void connectionClosed(javax.resource.spi.ConnectionEvent event)
connectionClosed in interface javax.resource.spi.ConnectionEventListenerpublic void connectionErrorOccurred(javax.resource.spi.ConnectionEvent event)
connectionErrorOccurred in interface javax.resource.spi.ConnectionEventListenerpublic java.lang.Exception getException()
nullpublic boolean controls(javax.resource.spi.ManagedConnection mc,
java.lang.Object connection)
mc - The managed connectionconnection - The connection; optionalpublic void dissociate()
throws javax.resource.ResourceException
javax.resource.ResourceException - if exception occurspublic boolean supportsLazyAssociation()
True if supported, otherwise falsepublic boolean supportsLazyEnlistment()
True if supported, otherwise falsepublic void localTransactionCommitted(javax.resource.spi.ConnectionEvent event)
localTransactionCommitted in interface javax.resource.spi.ConnectionEventListenerpublic void localTransactionRolledback(javax.resource.spi.ConnectionEvent event)
localTransactionRolledback in interface javax.resource.spi.ConnectionEventListenerpublic void localTransactionStarted(javax.resource.spi.ConnectionEvent event)
localTransactionStarted in interface javax.resource.spi.ConnectionEventListenerpublic void handleCreated(java.lang.Object h)
handleCreated in interface org.jboss.jca.core.spi.transaction.ConnectableResourceListenerh - The handlepublic void handleClosed(java.lang.Object h)
handleClosed in interface org.jboss.jca.core.spi.transaction.ConnectableResourceListenerh - The handlepublic void destroy()
public int compareTo(java.lang.Object o)
compareTo in interface java.lang.Comparableo - The other objectpublic java.lang.String toString()
toString in class java.lang.Objectprotected void toString(java.lang.StringBuffer buffer)
buffer - buffer instanceCopyright © 2014 IronJacamar (http://www.ironjacamar.org)