Interface XAStatefulHolder

All Known Subinterfaces:
XAResourceHolder
All Known Implementing Classes:
AbstractXAResourceHolder, AbstractXAStatefulHolder, DualSessionWrapper, DualSessionWrapper, EhCacheXAResourceHolder, JdbcPooledConnection, JmsPooledConnection, MessagingPooledConnection, 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.
Author:
lorban
  • Field Details

    • STATE_CLOSED

      static final int STATE_CLOSED
      The state in which the resource is when it is closed and unusable.
      See Also:
    • 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:
    • 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:
    • 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:
  • Method Details

    • 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

      List<XAResourceHolder> 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

      Object getConnectionHandle() throws 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:
      Exception - a resource-specific exception thrown when the disaposable connection cannot be created.
    • close

      void close() throws Exception
      Close the physical connection that this XAStatefulHolder represents.
      Throws:
      Exception - a resource-specific exception thrown when there is an error closing the physical connection.
    • getLastReleaseDate

      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.