XAStatefulHolder (Bitronix Transaction Manager :: Core 2.1.4 API)
Date: 2013-09-15

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## bitronix.tm.resource.common
Interface XAStatefulHolder

All Known Subinterfaces:
  XAResourceHolder

All Known Implementing Classes:
  AbstractXAResourceHolder, AbstractXAStatefulHolder, DualSessionWrapper, EhCacheXAResourceHolder, 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 `XAResourceHolder`s.

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.
`Object` | `getConnectionHandle()` Create a disposable handler used to drive a pooled instance of `XAStatefulHolder`.
`Date` | `getLastReleaseDate()` Get the date at which this object was last released to the pool.
`int` | `getState()` Get the current resource state.
`List<XAResourceHolder>` | `getXAResourceHolders()` Get the list of `XAResourceHolder`s 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

    List<XAResourceHolder> getXAResourceHolders()

  Get the list of `XAResourceHolder`s created by this `XAStatefulHolder` that are still open.

  This method is thread-safe.

  Returns:
    the list of `XAResourceHolder`s 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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2013 Bitronix Software. All Rights Reserved.