public abstract class AbstractConnectionListener extends java.lang.Object implements ConnectionListener
ConnectionListener interface
contract.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
trace
Log trace
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractConnectionListener(ConnectionManager cm,
javax.resource.spi.ManagedConnection managedConnection,
Pool pool,
java.lang.Object context,
org.jboss.jca.common.api.metadata.common.FlushStrategy flushStrategy)
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) |
void |
delist()
Delist the managed connection
|
void |
enlist()
Enlist the managed connection
|
protected CachedConnectionManager |
getCachedConnectionManager()
Gets cached connection manager
|
protected ConnectionManager |
getConnectionManager()
Gets connection manager.
|
java.lang.Object |
getContext()
Retrieve the context used by 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.
|
Pool |
getPool()
Retrieve the pool for this listener.
|
ConnectionState |
getState()
Retrieve the state of this connection.
|
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 |
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
|
void |
tidyup()
Tidyup
|
java.lang.String |
toString() |
protected void |
toString(java.lang.StringBuffer buffer)
Add specific properties.
|
void |
unregisterConnection(java.lang.Object handle)
Unregister a connection
|
protected void |
unregisterConnections()
Unregister connections.
|
void |
used()
Mark the connection as used
|
protected AbstractConnectionListener(ConnectionManager cm, javax.resource.spi.ManagedConnection managedConnection, Pool pool, java.lang.Object context, org.jboss.jca.common.api.metadata.common.FlushStrategy flushStrategy)
cm - connection managermanagedConnection - managed connectionpool - poolcontext - pool internal contextflushStrategy - flushStrategyprotected CachedConnectionManager getCachedConnectionManager()
protected ConnectionManager getConnectionManager()
protected abstract CoreLogger getLogger()
public void delist()
throws javax.resource.ResourceException
javax.resource.ResourceException - if exception occurspublic void enlist()
throws javax.transaction.SystemException
javax.transaction.SystemException - for errorspublic java.lang.Object getContext()
public long getLastValidatedTime()
public javax.resource.spi.ManagedConnection getManagedConnection()
getManagedConnection in interface 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 handleprotected void unregisterConnections()
public void used()
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 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 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 ? 2008-2009 Red Hat Middleware LLC (http://www.jboss.com/)