bitronix.tm.resource.common
Interface XAStatefulHolder

All Known Subinterfaces:
XAResourceHolder
All Known Implementing Classes:
AbstractXAResourceHolder, AbstractXAStatefulHolder, DualSessionWrapper, JdbcPooledConnection, JmsPooledConnection, RecoveryXAResourceHolder

public interface XAStatefulHolder

Any pooled connection class must implement the XAStatefulHolder interface. It defines all the services that must be implemented by the connection as well as the pooling lifecycle states. Instances of this interface have to create and manage XAResourceHolders.

© Bitronix Software

Author:
lorban

Field Summary
static int STATE_ACCESSIBLE
          The state in which the resource is when it out of the pool but accessible by the application.
static int STATE_CLOSED
          The state in which the resource is when it is closed and unusable.
static int STATE_IN_POOL
          The state in which the resource is when it is available in the pool.
static int STATE_NOT_ACCESSIBLE
          The state in which the resource is when it out of the pool but not accessible by the application.
 
Method Summary
 void addStateChangeEventListener(StateChangeListener listener)
          Register an implementation of StateChangeListener.
 void close()
          Close the physical connection that this XAStatefulHolder represents.
 java.lang.Object getConnectionHandle()
          Create a disposable handler used to drive a pooled instance of XAStatefulHolder.
 java.util.Date getLastReleaseDate()
          Get the date at which this object was last released to the pool.
 int getState()
          Get the current resource state.
 java.util.List getXAResourceHolders()
          Get the list of XAResourceHolders created by this XAStatefulHolder that are still open.
 void removeStateChangeEventListener(StateChangeListener listener)
          Unregister an implementation of StateChangeListener.
 void setState(int state)
          Set the current resource state.
 

Field Detail

STATE_CLOSED

static final int STATE_CLOSED
The state in which the resource is when it is closed and unusable.

See Also:
Constant Field Values

STATE_IN_POOL

static final int STATE_IN_POOL
The state in which the resource is when it is available in the pool.

See Also:
Constant Field Values

STATE_ACCESSIBLE

static final int STATE_ACCESSIBLE
The state in which the resource is when it out of the pool but accessible by the application.

See Also:
Constant Field Values

STATE_NOT_ACCESSIBLE

static final int STATE_NOT_ACCESSIBLE
The state in which the resource is when it out of the pool but not accessible by the application.

See Also:
Constant Field Values
Method Detail

getState

int getState()
Get the current resource state.

This method is thread-safe.

Returns:
the current resource state.

setState

void setState(int state)
Set the current resource state.

This method is thread-safe.

Parameters:
state - the current resource state.

addStateChangeEventListener

void addStateChangeEventListener(StateChangeListener listener)
Register an implementation of StateChangeListener.

Parameters:
listener - the StateChangeListener implementation to register.

removeStateChangeEventListener

void removeStateChangeEventListener(StateChangeListener listener)
Unregister an implementation of StateChangeListener.

Parameters:
listener - the StateChangeListener implementation to unregister.

getXAResourceHolders

java.util.List getXAResourceHolders()
Get the list of XAResourceHolders created by this XAStatefulHolder that are still open.

This method is thread-safe.

Returns:
the list of XAResourceHolders created by this XAStatefulHolder that are still open.

getConnectionHandle

java.lang.Object getConnectionHandle()
                                     throws java.lang.Exception
Create a disposable handler used to drive a pooled instance of XAStatefulHolder.

This method is thread-safe.

Returns:
a resource-specific disaposable connection object.
Throws:
java.lang.Exception - a resource-specific exception thrown when the disaposable connection cannot be created.

close

void close()
           throws java.lang.Exception
Close the physical connection that this XAStatefulHolder represents.

Throws:
java.lang.Exception - a resource-specific exception thrown when there is an error closing the physical connection.

getLastReleaseDate

java.util.Date getLastReleaseDate()
Get the date at which this object was last released to the pool. This is required to check if it is eligible for discard when the containing pool needs to shrink.

Returns:
the date at which this object was last released to the pool or null if it never left the pool.