|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.util.TransactionContext
com.sun.sgs.impl.service.data.Context
final class Context
Stores information for a specific transaction.
| Field Summary | |
|---|---|
(package private) ClassSerialization |
classSerial
Controls serializing classes. |
(package private) boolean |
detectModifications
Whether to detect modifications. |
(package private) ReferenceTable |
refs
Stores information about managed references. |
(package private) DataStore |
store
The data store. |
(package private) Transaction |
txn
The transaction. |
| Fields inherited from class com.sun.sgs.impl.util.TransactionContext |
|---|
isCommitted, isPrepared |
| Constructor Summary | |
|---|---|
Context(DataServiceImpl service,
DataStore store,
Transaction txn,
int debugCheckInterval,
boolean detectModifications,
ClassesTable classesTable,
boolean trackStaleObjects)
Creates an instance of this class. |
|
| Method Summary | ||
|---|---|---|
void |
abort(boolean retryable)
Aborts this context's involvement with the transaction associated with this context. |
|
void |
afterCompletion(boolean commit)
Called after a transaction is committed or aborted. |
|
void |
beforeCompletion()
Called after the main work of the transaction is complete, just before the transaction is prepared. |
|
(package private) void |
checkState()
Checks that the service is running or shutting down. |
|
void |
commit()
Commits this context's state. |
|
(package private)
|
findReference(T object)
Finds the existing reference associated with the specified object, returning null if it is not found. |
|
(package private) ManagedObject |
getBinding(String internalName,
boolean forUpdate)
Obtains the object associated with the specified internal name. |
|
(package private) ManagedReferenceImpl<?> |
getReference(long oid)
Obtains the reference associated with the specified ID. |
|
(package private)
|
getReference(T object)
Obtains the reference associated with the specified object. |
|
(package private) BigInteger |
getTxnId()
Returns the ID of the associated transaction as a BigInteger. |
|
String |
getTypeName()
Returns the fully qualified type name of the listener. |
|
(package private) void |
maybeCheckReferenceTable()
Checks the consistency of the reference table if the operation count equals the check interval. |
|
(package private) String |
nextBoundName(String internalName)
Returns the next bound name. |
|
(package private) long |
nextObjectId(long oid)
Returns the next object ID, or -1 if there are no more objects. |
|
(package private) boolean |
optimisticWriteLocks()
Returns whether to delay write locking until commit time. |
|
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. |
|
(package private) void |
removeBinding(String internalName)
Removes the object associated with the specified internal name. |
|
(package private) void |
removingObject(ManagedObjectRemoval object)
Calls removingObject on the argument, and checks for recursion. |
|
(package private)
|
safeFindReference(T object)
Finds the existing reference associated with the specified object, returning null if it is not found or has been removed. |
|
(package private) void |
setBinding(String internalName,
Object object)
Sets the object associated with the specified internal name. |
|
| Methods inherited from class com.sun.sgs.impl.util.TransactionContext |
|---|
getTransaction, isPrepared |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
final DataStore store
final Transaction txn
final boolean detectModifications
final ClassSerialization classSerial
final ReferenceTable refs
| Constructor Detail |
|---|
Context(DataServiceImpl service,
DataStore store,
Transaction txn,
int debugCheckInterval,
boolean detectModifications,
ClassesTable classesTable,
boolean trackStaleObjects)
| Method Detail |
|---|
<T> ManagedReferenceImpl<T> getReference(T object)
<T> ManagedReferenceImpl<T> findReference(T object)
<T> ManagedReferenceImpl<T> safeFindReference(T object)
ManagedReferenceImpl<?> getReference(long oid)
ManagedObject getBinding(String internalName,
boolean forUpdate)
void setBinding(String internalName,
Object object)
void removeBinding(String internalName)
String nextBoundName(String internalName)
long nextObjectId(long oid)
public boolean prepare()
throws Exception
TransactionContextisPrepared 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.
prepare in class TransactionContexttrue if this context's state is read-only,
false otherwise
Exception - if there is a problem preparing this
context's statepublic void commit()
TransactionContextisCommitted flag to true.
commit in class TransactionContext
public void prepareAndCommit()
throws Exception
TransactionContextisPrepared 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.
prepareAndCommit in class TransactionContextException - if there is a problem preparing this
context's statepublic void abort(boolean retryable)
TransactionContext
abort in class TransactionContextretryable - if true, the transaction's abort cause
is a retryable exceptionpublic void beforeCompletion()
Services. If the transaction has multiple
transaction listeners registered, the order in which the listeners are
called is unspecified.If this method throws an exception, then the transaction will be aborted, and the exception will be treated as if it were thrown by the main body of the transaction.
This method will not be called if the transaction is aborted before it reaches the preparation stage, including if an earlier call to this method on another listener throws an exception or aborts the transaction.
This implementation flushes managed references and marks the transaction inactive so that we'll notice if other beforeCompletion methods attempt to call the data service.
beforeCompletion in interface TransactionListenerpublic void afterCompletion(boolean commit)
true if the transaction committed, else false
if it aborted. If the transaction has multiple transaction listeners
registered, the order in which the listeners are called is unspecified. This implementation does nothing.
afterCompletion in interface TransactionListenercommit - true if the transaction committed, else
false if it abortedpublic String getTypeName()
getTypeName in interface TransactionListenervoid maybeCheckReferenceTable()
void checkState()
void removingObject(ManagedObjectRemoval object)
BigInteger getTxnId()
boolean optimisticWriteLocks()
|
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 | |||||||||