public class PhynixxXAResource<C extends IPhynixxConnection> extends Object implements IPhynixxXAResource<C>
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY| Constructor and Description |
|---|
PhynixxXAResource(String xaId,
TransactionManager transactionManager,
PhynixxXAResourceFactory<C> xaResourceFactory)
TODO timeOut ueber einen Listener steuern und konfigierbar machen
|
| Modifier and Type | Method and Description |
|---|---|
void |
addXAResourceListener(IPhynixxXAResourceListener<C> listener) |
void |
close()
finds the transactional branch of the current XAResource associated with
die XID
Close this XA XAResourceProgressState.
|
void |
commit(Xid xid,
boolean onePhase) |
void |
conditionViolated()
called when the current XAresource is expired (time out occurred) The
current Impl. does nothing but marked the associated TX as rollback only
The underlying core connection are not treated ....
|
void |
end(Xid xid,
int flags)
This method ends the work performed on behalf of a transaction branch.
|
boolean |
equals(Object obj) |
void |
forget(Xid xid)
finds the transactional branch of the current XAResource associated with
die XID and closes it without commit or explicit rollback
|
Object |
getId() |
int |
getTransactionTimeout() |
IPhynixxXAConnection<C> |
getXAConnection()
accessing the XAConnection forces the XAResource to enlist to the
Transaction.
|
int |
hashCode() |
boolean |
isClosed() |
boolean |
isSameRM(XAResource xaResource)
This method is called to determine if the resource manager instance
represented by the target object is the same as the resource manager
instance represented by the parameter xares .
|
boolean |
isSupportsTimeOut() |
int |
prepare(Xid xid)
finds the transactional branch of the current XAResource associated with
die XID
Prepares to perform a commit.
|
Xid[] |
recover(int flags)
the system is recovered by the xaResourceFactory representing the
persistence management system,
|
void |
removeXAResourceListener(IPhynixxXAResourceListener<C> listener) |
void |
rollback(Xid xid) |
void |
setSupportsTimeOut(boolean supportsTimeOut) |
boolean |
setTransactionTimeout(int seconds)
This method sets the transaction timeout value for this XAResource
instance.
|
void |
start(Xid xid,
int flags)
transaction branch is interchangeably with transaction context
situation : XAResource is associtaed with XID(1) flags=TMNOFLAGS with
XID(1) result : XAResource creates a new transactional context
situation : XAResource is associtaed with XID(1) flags=TMJOIN/TNRESUME
with XID(1) (may be different in branch) result : XAResource joins the
transactional context with the XAResource already associated with XID(1)
If TMRESUME is specified, start is to resume a suspended transaction
branch specified in xid.
|
String |
toString() |
public PhynixxXAResource(String xaId, TransactionManager transactionManager, PhynixxXAResourceFactory<C> xaResourceFactory)
public void conditionViolated()
public boolean isSupportsTimeOut()
public void setSupportsTimeOut(boolean supportsTimeOut)
public IPhynixxXAConnection<C> getXAConnection()
getXAConnection() must be called in the appropriate
TransactionContextgetXAConnection in interface IPhynixxXAResource<C extends IPhynixxConnection>public boolean isClosed()
public void start(Xid xid, int flags) throws XAException
situation : XAResource is associtaed with XID(1) flags=TMNOFLAGS with XID(1) result : XAResource creates a new transactional context
situation : XAResource is associtaed with XID(1) flags=TMJOIN/TNRESUME with XID(1) (may be different in branch) result : XAResource joins the transactional context with the XAResource already associated with XID(1) If TMRESUME is specified, start is to resume a suspended transaction branch specified in xid.
This method starts work on behalf of a transaction branch. If TMJOIN is specified, start is for joining an exisiting transaction branch xid. If neither TMJOIN nor TMRESUME is specified and the transaction branch specified in xid already exists, the resource manager throw the XAException with XAER_DUPID error code. If the XAResource has a current connection and flags ==TMJOIN/TMRESUME, the current connection is substituted by the connection of the existing TX.start in interface XAResourcexid - A global transaction identifier to be associated with the
resource.flags - One of TMNOFLAGS, TMJOIN, or TMRESUME.XAException - An error has occurred. Possible exceptions are XA_RB, XAER_RMERR, XAER_RMFAIL, XAER_DUPID, XAER_OUTSIDE,XAER_NOTA, XAER_INVAL, or XAER_PROTO.public void commit(Xid xid, boolean onePhase) throws XAException
commit in interface XAResourceXAExceptionpublic int prepare(Xid xid) throws XAException
prepare in interface XAResourcexid - A global transaction identifier.XAException - An error has occurred. Possible exception values are: XA_RB,
XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or
XAER_PROTO.public void rollback(Xid xid) throws XAException
rollback in interface XAResourceXAExceptionpublic void end(Xid xid, int flags) throws XAException
the spec doesn't no fix the order of commit/rollback and end and we have to take of both orders. If end comes before rollback/commit, the transactional branch has to be freeze. If rollback/commit comes before end, the transactional branch has to be closed
If TMSUCCESS is specified, the portion of work has completed successfully. end is called in Transaction.delistResourceend in interface XAResourcexid - A global transaction identifier.flags - If true, the resource manager should use a one-phase commit
protocol to commit the work done on behalf of xid.XAException - An error has occurred. Possible XAException values are XAER_RMERR, XAER_RMFAIL,XAER_NOTA, XAER_INVAL, XAER_PROTO,XA_RB.public void forget(Xid xid) throws XAException
forget in interface XAResourcexid - XAExceptionpublic int getTransactionTimeout()
throws XAException
getTransactionTimeout in interface XAResourceXAExceptionpublic boolean isSameRM(XAResource xaResource) throws XAException
isSameRM in interface XAResourcexaResource - An XAResource object.XAExceptionpublic void close()
public Xid[] recover(int flags) throws XAException
recover in interface XAResourceXAExceptionpublic boolean setTransactionTimeout(int seconds)
throws XAException
setTransactionTimeout in interface XAResourceseconds - An positive integer specifying the timout value in seconds.
Zero resets the transaction timeout value to the default one
used by the resource manager. A negative value results in
XAExceptio to be thrown with XAER_INVAL error code.XAException - An error has occurred. Possible exception values are:
XAER_RMERR, XAER_RMFAIL, or XAER_INVAL.public Object getId()
public void addXAResourceListener(IPhynixxXAResourceListener<C> listener)
public void removeXAResourceListener(IPhynixxXAResourceListener<C> listener)
Copyright © 2017. All rights reserved.