Class GenericXaResource
- java.lang.Object
-
- java.lang.Thread
-
- org.apache.ofbiz.entity.transaction.GenericXaResource
-
- All Implemented Interfaces:
java.lang.Runnable
,javax.transaction.xa.XAResource
- Direct Known Subclasses:
DebugXaResource
,ServiceXaWrapper
public abstract class GenericXaResource extends java.lang.Thread implements javax.transaction.xa.XAResource
GenericXaResource - Abstract XA Resource implementation supporting a single transaction
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
active
static java.lang.String
module
protected java.lang.Integer
timeout
timeout is an Integer and defaults to null so that we know if it is set on this object; if it isn't set we won't worry about the warning message, etc because we don't know what the real timeout isprotected javax.transaction.Transaction
trans
protected javax.transaction.xa.Xid
xid
-
Constructor Summary
Constructors Constructor Description GenericXaResource()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
commit(javax.transaction.xa.Xid xid, boolean onePhase)
void
end(javax.transaction.xa.Xid xid, int flag)
void
enlist()
Enlists this resource in the current transactionvoid
enlist(javax.transaction.Transaction tx)
Enlists this resource in the current transactionvoid
forget(javax.transaction.xa.Xid xid)
javax.transaction.Transaction
getTransaction()
int
getTransactionTimeout()
javax.transaction.xa.Xid
getXid()
boolean
isSameRM(javax.transaction.xa.XAResource xaResource)
int
prepare(javax.transaction.xa.Xid xid)
javax.transaction.xa.Xid[]
recover(int flag)
abstract void
rollback(javax.transaction.xa.Xid xid)
void
run()
void
runOnTimeout()
Method which will run when the transaction times outvoid
setTransaction(javax.transaction.Transaction t)
boolean
setTransactionTimeout(int seconds)
void
start(javax.transaction.xa.Xid xid, int flag)
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
module
public static final java.lang.String module
-
trans
protected javax.transaction.Transaction trans
-
active
protected boolean active
-
timeout
protected java.lang.Integer timeout
timeout is an Integer and defaults to null so that we know if it is set on this object; if it isn't set we won't worry about the warning message, etc because we don't know what the real timeout is
-
xid
protected javax.transaction.xa.Xid xid
-
-
Method Detail
-
enlist
public void enlist() throws javax.transaction.xa.XAException
Enlists this resource in the current transaction- Throws:
javax.transaction.xa.XAException
-
enlist
public void enlist(javax.transaction.Transaction tx) throws javax.transaction.xa.XAException
Enlists this resource in the current transaction- Throws:
javax.transaction.xa.XAException
-
start
public void start(javax.transaction.xa.Xid xid, int flag) throws javax.transaction.xa.XAException
- Specified by:
start
in interfacejavax.transaction.xa.XAResource
- Throws:
javax.transaction.xa.XAException
- See Also:
XAResource.start(javax.transaction.xa.Xid xid, int flag)
-
end
public void end(javax.transaction.xa.Xid xid, int flag) throws javax.transaction.xa.XAException
- Specified by:
end
in interfacejavax.transaction.xa.XAResource
- Throws:
javax.transaction.xa.XAException
- See Also:
XAResource.end(javax.transaction.xa.Xid xid, int flag)
-
forget
public void forget(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
- Specified by:
forget
in interfacejavax.transaction.xa.XAResource
- Throws:
javax.transaction.xa.XAException
- See Also:
XAResource.forget(javax.transaction.xa.Xid xid)
-
prepare
public int prepare(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
- Specified by:
prepare
in interfacejavax.transaction.xa.XAResource
- Throws:
javax.transaction.xa.XAException
- See Also:
XAResource.prepare(javax.transaction.xa.Xid xid)
-
recover
public javax.transaction.xa.Xid[] recover(int flag) throws javax.transaction.xa.XAException
- Specified by:
recover
in interfacejavax.transaction.xa.XAResource
- Throws:
javax.transaction.xa.XAException
- See Also:
XAResource.recover(int flag)
-
isSameRM
public boolean isSameRM(javax.transaction.xa.XAResource xaResource) throws javax.transaction.xa.XAException
- Specified by:
isSameRM
in interfacejavax.transaction.xa.XAResource
- Throws:
javax.transaction.xa.XAException
- See Also:
XAResource.isSameRM(javax.transaction.xa.XAResource xaResource)
-
getTransactionTimeout
public int getTransactionTimeout() throws javax.transaction.xa.XAException
- Specified by:
getTransactionTimeout
in interfacejavax.transaction.xa.XAResource
- Throws:
javax.transaction.xa.XAException
- See Also:
XAResource.getTransactionTimeout()
-
setTransactionTimeout
public boolean setTransactionTimeout(int seconds) throws javax.transaction.xa.XAException
- Specified by:
setTransactionTimeout
in interfacejavax.transaction.xa.XAResource
- Throws:
javax.transaction.xa.XAException
- See Also:
Note: the valus is saved but in the current implementation this is not used.
-
getTransaction
public javax.transaction.Transaction getTransaction()
-
setTransaction
public void setTransaction(javax.transaction.Transaction t)
-
getXid
public javax.transaction.xa.Xid getXid()
-
commit
public abstract void commit(javax.transaction.xa.Xid xid, boolean onePhase) throws javax.transaction.xa.XAException
- Specified by:
commit
in interfacejavax.transaction.xa.XAResource
- Throws:
javax.transaction.xa.XAException
- See Also:
XAResource.commit(javax.transaction.xa.Xid xid, boolean onePhase)
-
rollback
public abstract void rollback(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
- Specified by:
rollback
in interfacejavax.transaction.xa.XAResource
- Throws:
javax.transaction.xa.XAException
- See Also:
XAResource.rollback(javax.transaction.xa.Xid xid)
-
runOnTimeout
public void runOnTimeout()
Method which will run when the transaction times out
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classjava.lang.Thread
-
-