public class EhcacheXAResourceImpl extends Object implements EhcacheXAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
Constructor and Description |
---|
EhcacheXAResourceImpl(Ehcache cache,
Store underlyingStore,
TransactionManagerLookup txnManagerLookup,
SoftLockManager softLockManager,
TransactionIDFactory transactionIDFactory,
ElementValueComparator comparator,
org.terracotta.statistics.observer.OperationObserver<XaCommitOutcome> commitObserver,
org.terracotta.statistics.observer.OperationObserver<XaRollbackOutcome> rollbackObserver,
org.terracotta.statistics.observer.OperationObserver<XaRecoveryOutcome> recoveryObserver)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addTwoPcExecutionListener(XAExecutionListener listener)
Add a listener which will be called back according to the 2PC lifecycle
|
void |
commit(Xid xid,
boolean onePhase) |
void |
commitInternal(Xid xid,
boolean onePhase)
The commit implementation
|
XATransactionContext |
createTransactionContext()
Obtain the already associated
XATransactionContext with the current Transaction,
or create a new one should none be there yet. |
void |
end(Xid xid,
int flag) |
void |
forget(Xid xid) |
void |
forgetInternal(Xid xid)
The forget implementation
|
String |
getCacheName()
Getter to the name of the cache wrapped by this XAResource
|
XATransactionContext |
getCurrentTransactionContext()
Gets the current
XATransactionContext associated with this resource |
int |
getTransactionTimeout() |
boolean |
isSameRM(XAResource xaResource) |
int |
prepare(Xid xid) |
int |
prepareInternal(Xid xid)
The prepare implementation
|
Xid[] |
recover(int flags) |
void |
rollback(Xid xid) |
void |
rollbackInternal(Xid xid)
The rollback implementation
|
boolean |
setTransactionTimeout(int timeout) |
void |
start(Xid xid,
int flag) |
String |
toString() |
public EhcacheXAResourceImpl(Ehcache cache, Store underlyingStore, TransactionManagerLookup txnManagerLookup, SoftLockManager softLockManager, TransactionIDFactory transactionIDFactory, ElementValueComparator comparator, org.terracotta.statistics.observer.OperationObserver<XaCommitOutcome> commitObserver, org.terracotta.statistics.observer.OperationObserver<XaRollbackOutcome> rollbackObserver, org.terracotta.statistics.observer.OperationObserver<XaRecoveryOutcome> recoveryObserver)
cache
- the cacheunderlyingStore
- the underlying storetxnManagerLookup
- the transaction manager lookupsoftLockManager
- the soft lock managertransactionIDFactory
- the transaction ID factorycomparator
- the element value comparatorpublic void start(Xid xid, int flag) throws XAException
start
in interface XAResource
XAException
public void end(Xid xid, int flag) throws XAException
end
in interface XAResource
XAException
public void forget(Xid xid) throws XAException
forget
in interface XAResource
XAException
public void forgetInternal(Xid xid) throws XAException
xid
- a XIDXAException
- when an error occurspublic int getTransactionTimeout() throws XAException
getTransactionTimeout
in interface XAResource
XAException
public boolean isSameRM(XAResource xaResource) throws XAException
isSameRM
in interface XAResource
XAException
public int prepare(Xid xid) throws XAException
prepare
in interface XAResource
XAException
public int prepareInternal(Xid xid) throws XAException
xid
- a XIDXAException
- when an error occurspublic void commit(Xid xid, boolean onePhase) throws XAException
commit
in interface XAResource
XAException
public void commitInternal(Xid xid, boolean onePhase) throws XAException
xid
- a XIDonePhase
- true if onePhase, false otherwiseXAException
- when an error occurspublic Xid[] recover(int flags) throws XAException
recover
in interface XAResource
XAException
public void rollback(Xid xid) throws XAException
rollback
in interface XAResource
XAException
public void rollbackInternal(Xid xid) throws XAException
xid
- a XIDXAException
- when an error occurspublic boolean setTransactionTimeout(int timeout) throws XAException
setTransactionTimeout
in interface XAResource
XAException
public void addTwoPcExecutionListener(XAExecutionListener listener)
addTwoPcExecutionListener
in interface EhcacheXAResource
listener
- the XAExecutionListenerpublic String getCacheName()
getCacheName
in interface EhcacheXAResource
Ehcache.getName()
valuepublic XATransactionContext createTransactionContext() throws SystemException, RollbackException
XATransactionContext
with the current Transaction,
or create a new one should none be there yet.createTransactionContext
in interface EhcacheXAResource
XATransactionContext
SystemException
- Thrown if the associated transaction manager encounters an unexpected error condition.RollbackException
- Thrown if the resource has to be enlisted with the transaction, while it is marked for rollback only.public XATransactionContext getCurrentTransactionContext()
XATransactionContext
associated with this resourcegetCurrentTransactionContext
in interface EhcacheXAResource
XATransactionContext
, or null if noneCopyright © 2003–2016 Terracotta, Inc.. All rights reserved.