public abstract class AbstractConnectionListener extends java.lang.Object implements ConnectionListener
ConnectionListener
interface
contract.Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.CopyOnWriteArrayList<java.lang.Object> |
connectionHandles
Connection handles
|
protected boolean |
trace
Log trace
|
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)
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
|
void |
delist()
Delist the managed connection
|
void |
dissociate()
Dissociate the connection listener
|
void |
enlist()
Enlist the managed connection
|
protected CachedConnectionManager |
getCachedConnectionManager()
Gets cached connection manager
|
protected ConnectionManager |
getConnectionManager()
Gets connection manager.
|
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.
|
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 |
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
|
void |
unregisterConnections()
Unregister connections.
|
void |
used()
Mark the connection as used
|
protected boolean trace
protected java.util.concurrent.CopyOnWriteArrayList<java.lang.Object> connectionHandles
protected AbstractConnectionListener(ConnectionManager cm, javax.resource.spi.ManagedConnection managedConnection, Pool pool, ManagedConnectionPool mcp, org.jboss.jca.common.api.metadata.common.FlushStrategy flushStrategy)
cm
- connection managermanagedConnection
- managed connectionpool
- poolmcp
- managed connection poolflushStrategy
- flushStrategyprotected CachedConnectionManager getCachedConnectionManager()
protected ConnectionManager getConnectionManager()
protected abstract CoreLogger getLogger()
public int getNumberOfConnections()
public boolean isEnlisted()
public void delist() throws javax.resource.ResourceException
javax.resource.ResourceException
- if exception occurspublic void enlist() throws javax.transaction.SystemException
javax.transaction.SystemException
- for errorspublic ManagedConnectionPool getManagedConnectionPool()
public long getLastValidatedTime()
public javax.resource.spi.ManagedConnection getManagedConnection()
getManagedConnection
in interface ConnectionListener
public 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 used()
public void connectionClosed(javax.resource.spi.ConnectionEvent event)
connectionClosed
in interface javax.resource.spi.ConnectionEventListener
public void connectionErrorOccurred(javax.resource.spi.ConnectionEvent event)
connectionErrorOccurred
in interface javax.resource.spi.ConnectionEventListener
public 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 void localTransactionCommitted(javax.resource.spi.ConnectionEvent event)
localTransactionCommitted
in interface javax.resource.spi.ConnectionEventListener
public void localTransactionRolledback(javax.resource.spi.ConnectionEvent event)
localTransactionRolledback
in interface javax.resource.spi.ConnectionEventListener
public void localTransactionStarted(javax.resource.spi.ConnectionEvent event)
localTransactionStarted
in interface javax.resource.spi.ConnectionEventListener
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
o
- The other objectpublic java.lang.String toString()
toString
in class java.lang.Object
protected void toString(java.lang.StringBuffer buffer)
buffer
- buffer instanceCopyright © 2013 IronJacamar (http://www.ironjacamar.org)