|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.util.TransactionContext
public abstract class TransactionContext
A context to hold state associated with a transaction. A TransactionContext is created by the method TransactionContextFactory.createContext(com.sun.sgs.service.Transaction).
| Field Summary | |
|---|---|
protected boolean |
isCommitted
true if the transaction is committed. |
protected boolean |
isPrepared
true if the transaction is prepared. |
protected Transaction |
txn
The transaction. |
| Constructor Summary | |
|---|---|
TransactionContext(Transaction txn)
Constructs an instance of this class with the given transaction. |
|
| Method Summary | |
|---|---|
abstract void |
abort(boolean retryable)
Aborts this context's involvement with the transaction associated with this context. |
abstract void |
commit()
Commits this context's state. |
Transaction |
getTransaction()
Returns the transaction associated with this context. |
boolean |
isPrepared()
Returns true if this context is prepared, otherwise
returns false. |
boolean |
prepare()
Prepares state for the transaction associated with this context, sets the isPrepared flag to true, and
returns true if this context's state is read-only and
returns false otherwise. |
void |
prepareAndCommit()
Prepares state for the transaction associated with this context, sets the isPrepared flag to true, and if
this context's state is not read-only, commits this context's
state. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final Transaction txn
protected boolean isPrepared
true if the transaction is prepared.
protected boolean isCommitted
true if the transaction is committed.
| Constructor Detail |
|---|
public TransactionContext(Transaction txn)
txn - a transaction| Method Detail |
|---|
public boolean prepare()
throws Exception
isPrepared flag to true, and
returns true if this context's state is read-only and
returns false otherwise. In the case that this method
is overridden and returns true, that implementation
should also set the isCommitted flag to true.
The default implementation of this method sets the isPrepared flag to true and returns false.
true if this context's state is read-only,
false otherwise
Exception - if there is a problem preparing this
context's state
public void prepareAndCommit()
throws Exception
isPrepared flag to true, and if
this context's state is not read-only, commits this context's
state. This method should also set the isCommitted
flag to true.
The default implementation of this method invokes prepare to prepare state for the transaction
associated with this context, and if prepare returns
false, then invokes commit to commit
this context's state.
Exception - if there is a problem preparing this
context's statepublic abstract void abort(boolean retryable)
retryable - if true, the transaction's abort cause
is a retryable exceptionpublic abstract void commit()
isCommitted flag to true.
public Transaction getTransaction()
public boolean isPrepared()
true if this context is prepared, otherwise
returns false.
true if this context is prepared, otherwise
returns false
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||