Package net.jini.core.transaction.server
Class NestableServerTransaction
java.lang.Object
net.jini.core.transaction.server.ServerTransaction
net.jini.core.transaction.server.NestableServerTransaction
- All Implemented Interfaces:
ISwapExternalizable,SmartExternalizable,Externalizable,Serializable,ManagedTransaction,NestableTransaction,Transaction
Class implementing the
NestableTransaction interface, for use with transaction
participants that implement the default transaction semantics.- Since:
- 1.0
- Author:
- Sun Microsystems, Inc.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.jini.core.transaction.NestableTransaction
NestableTransaction.CreatedNested classes/interfaces inherited from interface net.jini.core.transaction.Transaction
Transaction.Created -
Field Summary
FieldsModifier and TypeFieldDescriptionThe parent transaction, if any.Fields inherited from class net.jini.core.transaction.server.ServerTransaction
EMBEDDED_CRASH_COUNT, id, mgr -
Constructor Summary
ConstructorsConstructorDescriptionDo not use.NestableServerTransaction(NestableTransactionManager mgr, long id, NestableServerTransaction parent, long lease) Simple constructor. -
Method Summary
Modifier and TypeMethodDescriptioncreate(long leaseTime) Create a new nested transaction, with the current transaction as parent, managed by the same transaction manager as the current transaction.create(NestableTransactionManager mgr, long leaseTime) Create a new nested transaction, with the current transaction as parent, managed by the given transaction manager.booleanenclosedBy(NestableTransaction enclosing) Return true if the specified transaction is an ancestor of this transaction.booleanisNested()Return true if the transaction has a parent, false if the transaction is top level.voidpromote(TransactionParticipant[] parts, long[] crashCounts, TransactionParticipant drop) Promote the listed participants (from a subtransaction) into this (the parent) transaction.voidtoString()voidMethods inherited from class net.jini.core.transaction.server.ServerTransaction
abort, abort, commit, commit, create, createCopy, createInstance, equals, getLease, getMetaData, getState, getTransactionManager, hashCode, initEmbedded, isEmbeddedMgrInProxy, isEmbeddedMgrProxySideInstance, isXid, join, join, join, joinIfNeededAndEmbedded, joinIfNeededAndEmbedded, needParticipantsJoin, readFromSwap, setEmbeddedMgrProxySideInstance, setLease, setMetaData, writeToSwapMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.gigaspaces.serialization.SmartExternalizable
enabledSmartExternalizableWithReferenceMethods inherited from interface net.jini.core.transaction.Transaction
abort, abort, commit, commit
-
Field Details
-
parent
The parent transaction, if any.
-
-
Constructor Details
-
NestableServerTransaction
public NestableServerTransaction()Do not use. Externilzable only. -
NestableServerTransaction
public NestableServerTransaction(NestableTransactionManager mgr, long id, NestableServerTransaction parent, long lease) Simple constructor. Clients should not call this directly, but should instead useTransactionFactoryandNestableTransactionmethods.- Parameters:
mgr- the manager for this transactionid- the transaction idparent- the parent transaction, if any
-
-
Method Details
-
create
public NestableTransaction.Created create(NestableTransactionManager mgr, long leaseTime) throws UnknownTransactionException, CannotJoinException, LeaseDeniedException, RemoteException Description copied from interface:NestableTransactionCreate a new nested transaction, with the current transaction as parent, managed by the given transaction manager.- Specified by:
createin interfaceNestableTransaction- Parameters:
mgr- the transaction manager to use for this transactionleaseTime- the requested lease time for the transaction- Returns:
- the created transaction and the lease granted
- Throws:
UnknownTransactionException- if the parent transaction is unknown to the parent transaction manager, either because the transaction ID is incorrect or because the transaction is no longer active and its state has been discarded by the manager.CannotJoinException- if the parent transaction is known to the manager but is no longer active.LeaseDeniedException- if this manager is unwilling to grant the requested lease timeRemoteException- if there is a communication error
-
create
public NestableTransaction.Created create(long leaseTime) throws UnknownTransactionException, CannotJoinException, LeaseDeniedException, RemoteException Description copied from interface:NestableTransactionCreate a new nested transaction, with the current transaction as parent, managed by the same transaction manager as the current transaction.- Specified by:
createin interfaceNestableTransaction- Parameters:
leaseTime- the requested lease time for the transaction- Returns:
- the created transaction and the lease granted
- Throws:
UnknownTransactionException- if the parent transaction is unknown to the parent transaction manager, either because the transaction ID is incorrect or because the transaction is no longer active and its state has been discarded by the manager.CannotJoinException- if the parent transaction is known to the manager but is no longer active.LeaseDeniedException- if this manager is unwilling to grant the requested lease timeRemoteException- if there is a communication error
-
promote
public void promote(TransactionParticipant[] parts, long[] crashCounts, TransactionParticipant drop) throws UnknownTransactionException, CannotJoinException, CrashCountException, RemoteException Promote the listed participants (from a subtransaction) into this (the parent) transaction. This method is for use by the manager of a subtransaction when the subtransaction commits. At this point, all participants of the subtransaction must become participants in the parent transaction. Prior to this point, the subtransaction's manager was a participant of the parent transaction, but after a successful promotion it need no longer be one (if it was not itself a participant of the subtransaction), and so it may specify itself as a participant to drop from the transaction. Otherwise, participants should not be dropped out of transactions. For each promoted participant, the participant's crash count is stored in the corresponding element of thecrashCountsarray.- Parameters:
parts- the participants being promoted to the parentcrashCounts- the crash counts of the participantsdrop- the manager to drop out, if any- Throws:
CrashCountException- if the crash count provided for at least one participant differs from the crash count in a previous invocation of the same pairing of participant and transactionUnknownTransactionException- if a transaction is unknown to the transaction manager, either because the transaction ID is incorrect or because the transaction is complete and its state has been discarded by the manager.CannotJoinException- if a transaction is known to the manager but is no longer active.RemoteException- if there is a communication error- See Also:
-
enclosedBy
Return true if the specified transaction is an ancestor of this transaction.- Parameters:
enclosing- transaction to test for being an ancestor- Returns:
- true if the specified transaction is an ancestor of this transaction.
-
isNested
public boolean isNested()Description copied from class:ServerTransactionReturn true if the transaction has a parent, false if the transaction is top level.- Overrides:
isNestedin classServerTransaction- Returns:
- true if the transaction has a parent, false if the transaction is top level.
-
toString
- Overrides:
toStringin classServerTransaction
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Overrides:
writeExternalin classServerTransaction- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Overrides:
readExternalin classServerTransaction- Throws:
IOExceptionClassNotFoundException
-