bitronix.tm.resource.common
Class XAPool

java.lang.Object
  extended by bitronix.tm.resource.common.XAPool
All Implemented Interfaces:
StateChangeListener

public class XAPool
extends java.lang.Object
implements StateChangeListener

Generic XA pool. XAStatefulHolder instances are created by the XAPool out of a XAResourceProducer. Those objects are then pooled and can be retrieved and/or recycled by the pool depending on the running XA transaction's and the XAStatefulHolder's states.

© Bitronix Software

Author:
lorban

Constructor Summary
XAPool(XAResourceProducer xaResourceProducer, ResourceBean bean)
           
 
Method Summary
 void close()
           
 XAResourceHolder findXAResourceHolder(javax.transaction.xa.XAResource xaResource)
           
 java.lang.Object getConnectionHandle()
           
 java.lang.Object getConnectionHandle(boolean recycle)
           
 java.util.Date getNextShrinkDate()
           
 java.lang.Object getXAFactory()
           
 java.util.List getXAResourceHolders()
           
 long inPoolSize()
           
 void setFailed(boolean failed)
           
 void shrink()
           
 void stateChanged(XAStatefulHolder source, int oldState, int newState)
          Fired when the internal state of a XAStatefulHolder has changed.
 void stateChanging(XAStatefulHolder source, int currentState, int futureState)
          Fired before the internal state of a XAStatefulHolder has changed.
 java.lang.String toString()
           
 long totalPoolSize()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XAPool

public XAPool(XAResourceProducer xaResourceProducer,
              ResourceBean bean)
       throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

getXAFactory

public java.lang.Object getXAFactory()

setFailed

public void setFailed(boolean failed)

getConnectionHandle

public java.lang.Object getConnectionHandle()
                                     throws java.lang.Exception
Throws:
java.lang.Exception

getConnectionHandle

public java.lang.Object getConnectionHandle(boolean recycle)
                                     throws java.lang.Exception
Throws:
java.lang.Exception

close

public void close()

totalPoolSize

public long totalPoolSize()

inPoolSize

public long inPoolSize()

stateChanged

public void stateChanged(XAStatefulHolder source,
                         int oldState,
                         int newState)
Description copied from interface: StateChangeListener
Fired when the internal state of a XAStatefulHolder has changed.

Specified by:
stateChanged in interface StateChangeListener
Parameters:
source - the XAStatefulHolder changing state.
oldState - the old state of the XAStatefulHolder.
newState - the new state of the XAStatefulHolder.

stateChanging

public void stateChanging(XAStatefulHolder source,
                          int currentState,
                          int futureState)
Description copied from interface: StateChangeListener
Fired before the internal state of a XAStatefulHolder has changed.

Specified by:
stateChanging in interface StateChangeListener
Parameters:
source - the XAStatefulHolder changing state.
currentState - the current state of the XAStatefulHolder.
futureState - the future state of the XAStatefulHolder.

findXAResourceHolder

public XAResourceHolder findXAResourceHolder(javax.transaction.xa.XAResource xaResource)

getXAResourceHolders

public java.util.List getXAResourceHolders()

getNextShrinkDate

public java.util.Date getNextShrinkDate()

shrink

public void shrink()
            throws java.lang.Exception
Throws:
java.lang.Exception

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object