public class XAPool<R extends XAResourceHolder<R>,T extends XAStatefulHolder<T>> extends Object implements StateChangeListener<T>
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.| Constructor and Description |
|---|
XAPool(XAResourceProducer<R,T> xaResourceProducer,
ResourceBean bean,
Object xaFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close down and cleanup this XAPool instance.
|
Object |
getConnectionHandle()
Get a connection handle from this pool.
|
Object |
getConnectionHandle(boolean recycle)
Get a connection handle from this pool.
|
Date |
getNextShrinkDate() |
Object |
getXAFactory()
Get the XAFactory (XADataSource) that produces objects for this pool.
|
List<T> |
getXAResourceHolders() |
int |
inPoolSize()
Get the number of objects in the available pool.
|
boolean |
isFailed()
Is the XAPool in a failed state?
|
void |
reset() |
void |
setFailed(boolean failed)
Sets this XAPool as failed or unfailed, requiring recovery.
|
void |
shrink() |
void |
stateChanged(T source,
XAStatefulHolder.State oldState,
XAStatefulHolder.State newState)
Fired when the internal state of a
XAStatefulHolder has changed. |
void |
stateChanging(T source,
XAStatefulHolder.State currentState,
XAStatefulHolder.State futureState)
Fired before the internal state of a
XAStatefulHolder has changed. |
String |
toString() |
int |
totalPoolSize()
Get the total size of this pool.
|
public XAPool(XAResourceProducer<R,T> xaResourceProducer, ResourceBean bean, Object xaFactory) throws Exception
Exceptionpublic void close()
public Object getConnectionHandle() throws Exception
Exception - throw in the pool is unrecoverable or a timeout occurs getting a connectionpublic Object getConnectionHandle(boolean recycle) throws Exception
recycle - true if we should try to get a connection in the NON_ACCESSIBLE pool in the same transactionException - throw in the pool is unrecoverable or a timeout occurs getting a connectionpublic void stateChanging(T source, XAStatefulHolder.State currentState, XAStatefulHolder.State futureState)
StateChangeListenerXAStatefulHolder has changed.stateChanging in interface StateChangeListener<T extends XAStatefulHolder<T>>source - the XAStatefulHolder changing state.currentState - the current state of the XAStatefulHolder.futureState - the future state of the XAStatefulHolder.public void stateChanged(T source, XAStatefulHolder.State oldState, XAStatefulHolder.State newState)
StateChangeListenerXAStatefulHolder has changed.stateChanged in interface StateChangeListener<T extends XAStatefulHolder<T>>source - the XAStatefulHolder changing state.oldState - the old state of the XAStatefulHolder.newState - the new state of the XAStatefulHolder.public Date getNextShrinkDate()
public Object getXAFactory()
public void setFailed(boolean failed)
failed - true if this XAPool has failed and requires recovery, false if it is okpublic boolean isFailed()
public int totalPoolSize()
public int inPoolSize()
Copyright © 2006-2016 Bitronix Software. All Rights Reserved.