public class XactXAResourceManager extends java.lang.Object implements XAResourceManager
This interface allows access to commit,prepare,abort global transactions as part of a two phase commit protocol. These interfaces have been chosen to be exact implementations required to implement the XAResource interfaces as part of the JTA standard extension.
It is expected that the following interfaces are only used during the recovery portion of 2 phase commit, when the transaction manager is cleaning up after a runtime crash - it is expected that no current context managers exist for the Xid's being operated on. The "online" two phase commit protocol will be implemented by calls directly on a TransactionController.
The XAResource interface is a Java mapping of the industry standard XA resource manager interface. Please refer to: X/Open CAE Specification - Distributed Transaction Processing: The XA Specification, X/Open Document No. XO/CAE/91/300 or ISBN 1 872630 24 3.
XAResourceManager
Modifier and Type | Field and Description |
---|---|
private RawStoreFactory |
rsf |
private TransactionTable |
transaction_table
Fields of the class
|
Constructor and Description |
---|
XactXAResourceManager(RawStoreFactory rsf,
TransactionTable tt)
Constructors for This class:
|
Modifier and Type | Method and Description |
---|---|
void |
commit(ContextManager cm,
javax.transaction.xa.Xid xid,
boolean onePhase)
This method is called to commit the global transaction specified by xid.
|
ContextManager |
find(javax.transaction.xa.Xid xid)
Find the given Xid in the transaction table.
|
void |
forget(ContextManager cm,
javax.transaction.xa.Xid xid)
This method is called to remove the given transaction
from the transaction table/log.
|
javax.transaction.xa.Xid[] |
recover(int flags)
This method is called to obtain a list of prepared transactions.
|
void |
rollback(ContextManager cm,
javax.transaction.xa.Xid xid)
rollback the transaction identified by Xid.
|
private TransactionTable transaction_table
private RawStoreFactory rsf
public XactXAResourceManager(RawStoreFactory rsf, TransactionTable tt)
public void commit(ContextManager cm, javax.transaction.xa.Xid xid, boolean onePhase) throws StandardException
RESOLVE - how do we map to the "right" XAExceptions.
commit
in interface XAResourceManager
cm
- The ContextManager returned from the find() call.xid
- A global transaction identifier.onePhase
- If true, the resource manager should use a one-phase
commit protocol to commit the work done on behalf of
xid.StandardException
- Standard exception policy.public ContextManager find(javax.transaction.xa.Xid xid)
This routine is used to find a in-doubt transaction from the list of Xid's returned from the recover() routine.
In the current implementation it is up to the calling routine to make the returned ContextManager the "current" ContextManager before calls to commit,abort, or forget. The caller is responsible for error handling, ie. calling cleanupOnError() on the correct ContextManager.
If the Xid is not in the system, "null" is returned. RESOLVE - find out from sku if she wants a exception instead?
find
in interface XAResourceManager
xid
- A global transaction identifier.public void forget(ContextManager cm, javax.transaction.xa.Xid xid) throws StandardException
Used to let the store remove all record from log and transaction table of the given transaction. This should only be used to clean up heuristically completed transactions, otherwise commit or abort should be used to act on other transactions.
forget
in interface XAResourceManager
cm
- The ContextManager returned from the find() call.xid
- A global transaction identifier.StandardException
- Standard exception policy.public javax.transaction.xa.Xid[] recover(int flags) throws StandardException
This call returns a complete list of global transactions which are either prepared or heuristically complete.
The XAResource interface expects a scan type interface, but our implementation only returns a complete list of transactions. So to simulate the scan the following state is maintained. If TMSTARTSCAN is specified the complete list is returned. If recover is called with TMNOFLAGS is ever called a 0 length array is returned.
recover
in interface XAResourceManager
flags
- combination of the following flags
XAResource.{TMSTARTRSCAN,TMENDRSCAN,TMNOFLAGS}.
TMNOFLAGS must be used when no other flags are used.StandardException
- Standard exception policy.public void rollback(ContextManager cm, javax.transaction.xa.Xid xid) throws StandardException
The given transaction is roll'ed back and it's history is not maintained in the transaction table or long term log.
rollback
in interface XAResourceManager
cm
- The ContextManager returned from the find() call.xid
- A global transaction identifier.StandardException
- Standard exception policy.Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.