org.jboss.jca.core.connectionmanager.listener
Interface ConnectionListener

All Superinterfaces:
Comparable, javax.resource.spi.ConnectionEventListener, org.jboss.jca.core.api.connectionmanager.listener.ConnectionListener, EventListener

public interface ConnectionListener
extends org.jboss.jca.core.api.connectionmanager.listener.ConnectionListener

Connection listener.

Author:
Gurkan Erdogdu, Adrian Brock, Weston Price, Jesper Pedersen

Method Summary
 void delist()
          Delist the managed connection
 void enlist()
          Enlist the managed connection
 Object getContext()
          Retrieve the context used by the pool.
 long getLastValidatedTime()
          Retrieve the last time this connection was validated.
 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 registerConnection(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
 void unregisterConnection(Object handle)
          Unregister a connection
 void used()
          Mark the connection as used
 
Methods inherited from interface org.jboss.jca.core.api.connectionmanager.listener.ConnectionListener
getManagedConnection
 
Methods inherited from interface javax.resource.spi.ConnectionEventListener
connectionClosed, connectionErrorOccurred, localTransactionCommitted, localTransactionRolledback, localTransactionStarted
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

getPool

Pool getPool()
Retrieve the pool for this listener.

Returns:
the pool

tidyup

void tidyup()
            throws javax.resource.ResourceException
Tidyup

Invoked just before returning the connection to the pool when the connection is not being destroyed.

Throws:
javax.resource.ResourceException - for any error

getContext

Object getContext()
Retrieve the context used by the pool.

Returns:
the context

getState

ConnectionState getState()
Retrieve the state of this connection.

Returns:
the state

setState

void setState(ConnectionState newState)
Set the state of this connection.

Parameters:
newState - new state

isTimedOut

boolean isTimedOut(long timeout)
Has the connection timed out?

Parameters:
timeout - the timeout
Returns:
true for timed out, false otherwise

used

void used()
Mark the connection as used


registerConnection

void registerConnection(Object handle)
Register a new connection

Parameters:
handle - the connection handle

unregisterConnection

void unregisterConnection(Object handle)
Unregister a connection

Parameters:
handle - the connection handle

isManagedConnectionFree

boolean isManagedConnectionFree()
Is the managed connection free?

Returns:
true when it is free

enlist

void enlist()
            throws SystemException
Enlist the managed connection

Throws:
SystemException - for errors

delist

void delist()
            throws javax.resource.ResourceException
Delist the managed connection

Throws:
javax.resource.ResourceException - if exception occurs

isTrackByTx

boolean isTrackByTx()
Get whether the listener is track by transaction

Returns:
true for track by transaction, false otherwise

setTrackByTx

void setTrackByTx(boolean trackByTx)
Set whether the listener is track by transaction

Parameters:
trackByTx - true for track by transaction, false otherwise

getLastValidatedTime

long getLastValidatedTime()
Retrieve the last time this connection was validated.

Returns:
the last time the connection was validated

setLastValidatedTime

void setLastValidatedTime(long lastValidated)
Set the last time, in milliseconds, that this connection was validated.

Parameters:
lastValidated - the last time the connection was validated in milliseconds.


Copyright © 2012 JBoss, by Red Hat (http://www.jboss.org/ironjacamar)