GigaSpaces XAP 10.0.1 API

net.jini.core.transaction.server
Class NestableServerTransaction

java.lang.Object
  extended by net.jini.core.transaction.server.ServerTransaction
      extended by net.jini.core.transaction.server.NestableServerTransaction
All Implemented Interfaces:
com.gigaspaces.internal.server.space.redolog.storage.bytebuffer.ISwapExternalizable, Externalizable, Serializable, ManagedTransaction, NestableTransaction, Transaction

public class NestableServerTransaction
extends ServerTransaction
implements NestableTransaction

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:
NestableTransaction, NestableTransactionManager, TransactionFactory, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface net.jini.core.transaction.NestableTransaction
NestableTransaction.Created
 
Field Summary
 NestableServerTransaction parent
          The parent transaction, if any.
 
Fields inherited from class net.jini.core.transaction.server.ServerTransaction
EMBEDDED_CRASH_COUNT, id, mgr
 
Constructor Summary
NestableServerTransaction()
          Do not use.
NestableServerTransaction(NestableTransactionManager mgr, long id, NestableServerTransaction parent, long lease)
          Simple constructor.
 
Method Summary
 NestableTransaction.Created create(long leaseTime)
          Create a new nested transaction, with the current transaction as parent, managed by the same transaction manager as the current transaction.
 NestableTransaction.Created create(NestableTransactionManager mgr, long leaseTime)
          Create a new nested transaction, with the current transaction as parent, managed by the given transaction manager.
 boolean enclosedBy(NestableTransaction enclosing)
          Return true if the specified transaction is an ancestor of this transaction.
 boolean isNested()
          Return true if the transaction has a parent, false if the transaction is top level.
 void promote(TransactionParticipant[] parts, long[] crashCounts, TransactionParticipant drop)
          Promote the listed participants (from a subtransaction) into this (the parent) transaction.
 void readExternal(ObjectInput in)
           
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class net.jini.core.transaction.server.ServerTransaction
abort, abort, commit, commit, create, createCopy, createInstance, equals, getLease, getMetaData, getState, hashCode, initEmbedded, isEmbeddedMgrInProxy, isEmbeddedMgrProxySideInstance, isXid, join, join, join, joinIfNeededAndEmbedded, joinIfNeededAndEmbedded, needParticipantsJoin, readFromSwap, setEmbeddedMgrProxySideInstance, setLease, setMetaData, writeToSwap
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.jini.core.transaction.Transaction
abort, abort, commit, commit
 

Field Detail

parent

public NestableServerTransaction parent
The parent transaction, if any.

Constructor Detail

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 use TransactionFactory and NestableTransaction methods.

Parameters:
mgr - the manager for this transaction
id - the transaction id
parent - the parent transaction, if any
Method Detail

create

public NestableTransaction.Created create(NestableTransactionManager mgr,
                                          long leaseTime)
                                   throws UnknownTransactionException,
                                          CannotJoinException,
                                          LeaseDeniedException,
                                          RemoteException
Description copied from interface: NestableTransaction
Create a new nested transaction, with the current transaction as parent, managed by the given transaction manager.

Specified by:
create in interface NestableTransaction
Parameters:
mgr - the transaction manager to use for this transaction
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 time
RemoteException - if there is a communication error

create

public NestableTransaction.Created create(long leaseTime)
                                   throws UnknownTransactionException,
                                          CannotJoinException,
                                          LeaseDeniedException,
                                          RemoteException
Description copied from interface: NestableTransaction
Create a new nested transaction, with the current transaction as parent, managed by the same transaction manager as the current transaction.

Specified by:
create in interface NestableTransaction
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 time
RemoteException - 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 the crashCounts array.

Parameters:
parts - the participants being promoted to the parent
crashCounts - the crash counts of the participants
drop - 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 transaction
UnknownTransactionException - 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:
NestableTransactionManager.promote(long, net.jini.core.transaction.server.TransactionParticipant[], long[], net.jini.core.transaction.server.TransactionParticipant)

enclosedBy

public boolean enclosedBy(NestableTransaction enclosing)
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: ServerTransaction
Return true if the transaction has a parent, false if the transaction is top level.

Overrides:
isNested in class ServerTransaction
Returns:
true if the transaction has a parent, false if the transaction is top level.

toString

public String toString()
Overrides:
toString in class ServerTransaction

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class ServerTransaction
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class ServerTransaction
Throws:
IOException
ClassNotFoundException

GigaSpaces XAP 10.0.1 API

Copyright © GigaSpaces.