|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.TimerTask org.apache.jackrabbit.util.Timer.Task org.apache.jackrabbit.core.TransactionContext
public class TransactionContext
Represents the transaction on behalf of the component that wants to
explicitly demarcate transaction boundaries. After having been prepared,
schedules a task that rolls back the transaction if some time passes without
any further action. This will guarantee that global objects locked by one
of the resources' InternalXAResource.prepare(org.apache.jackrabbit.core.TransactionContext)
method, are eventually
unlocked.
Constructor Summary | |
---|---|
TransactionContext(Xid xid,
InternalXAResource[] resources,
int timeout)
Create a new instance of this class. |
Method Summary | |
---|---|
void |
commit()
Commit the transaction identified by this context. |
Object |
getAttribute(String name)
Return an attribute value on this transaction. |
static Object |
getCurrentThreadId()
Returns the current thread identifier. |
static Xid |
getCurrentXid()
Returns the Xid bind to the CURRENT_XID ThreadLocal |
static boolean |
isSameThreadId(Object a,
Object b)
Compares the given thread identifiers for equality. |
boolean |
isSuspended()
Return a flag indicating whether the association is suspended. |
void |
prepare()
Prepare the transaction identified by this context. |
void |
removeAttribute(String name)
Remove an attribute on this transaction. |
void |
rollback()
Rollback the transaction identified by this context. |
void |
run()
Rolls back the transaction if still prepared and marks the transaction rolled back. |
void |
setAttribute(String name,
Object value)
Set an attribute on this transaction. |
void |
setSuspended(boolean suspended)
Set a flag indicating whether the association is suspended. |
Methods inherited from class org.apache.jackrabbit.util.Timer.Task |
---|
cancel |
Methods inherited from class java.util.TimerTask |
---|
scheduledExecutionTime |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TransactionContext(Xid xid, InternalXAResource[] resources, int timeout)
xid
- associated xidresources
- transactional resourcestimeout
- timeout, in secondsMethod Detail |
---|
public void setAttribute(String name, Object value)
null
, it is semantically equivalent to
removeAttribute(java.lang.String)
.
name
- attribute namevalue
- attribute valuepublic Object getAttribute(String name)
name
- attribute name
null
if no attribute with that
name existspublic void removeAttribute(String name)
name
- attribute namepublic void prepare() throws XAException
XAException
- if an error occurspublic void commit() throws XAException
XAException
- if an error occurspublic void rollback() throws XAException
XAException
- if an error occurspublic void run()
run
in interface Runnable
run
in class TimerTask
public boolean isSuspended()
true
if the association is suspended;
false
otherwisepublic void setSuspended(boolean suspended)
suspended
- flag whether that the association is suspended.public static Xid getCurrentXid()
Xid
bind to the CURRENT_XID
ThreadLocal
public static Object getCurrentThreadId()
public static boolean isSameThreadId(Object a, Object b)
getCurrentThreadId()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |