GigaSpaces XAP 10.0.1 API

com.sun.jini.mahalo
Class TxnMgrProxy

java.lang.Object
  extended by com.sun.jini.mahalo.TxnMgrProxy
All Implemented Interfaces:
MarshalPivotProvider, Externalizable, Serializable, Remote, Administrable, ExtendedTransactionManager, TransactionConstants, TransactionManager, ReferentUuid

public class TxnMgrProxy
extends Object
implements ExtendedTransactionManager, Administrable, Externalizable, ReferentUuid, MarshalPivotProvider

A TxnMgrProxy is a proxy for the transaction manager service. This is the object passed to clients of this service. It implements the TransactionManager and the Administrable interfaces.

Since:
1.1
Author:
Sun Microsystems, Inc.
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface net.jini.core.transaction.server.TransactionManager
TransactionManager.Created
 
Field Summary
 Uuid proxyID
          The proxy's Uuid
 
Fields inherited from interface net.jini.core.transaction.server.TransactionConstants
ABORTED, ACTIVE, COMMITTED, NOTCHANGED, PREPARED, VOTING
 
Constructor Summary
TxnMgrProxy()
           
 
Method Summary
 void abort(long id)
          Abort the transaction.
 void abort(long id, long waitFor)
          Abort the transaction, waiting for participants to be notified of the decision.
 void abort(Object xid)
           
 void abort(Object xid, long waitFor)
           
 void commit(long id)
          Commit the transaction.
 void commit(long id, long waitFor)
          Commit the transaction, waiting for participants to be notified of the decision.
 void commit(Object xid)
           
 void commit(Object xid, long waitFor)
           
 TransactionManager.Created create(long lease)
          Begin a new top-level transaction.
 TransactionManager.Created create(Object xid, long lease)
           
static TxnMgrProxy create(TxnManager txnMgr, TxnManager direct, Uuid id)
           
 TxnMgrProxy createLightProxy()
           
 boolean disJoin(long id, TransactionParticipant part)
          Remove a participant that was joined for a first time. called when a call to a participant returned empty so we can spare calling commit or abort on it, usually used in embedded mahalo
 boolean equals(Object o)
          Proxies for servers with the same proxyID are considered equal.
 Object getAdmin()
          Returns an object that implements whatever administration interfaces are appropriate for the particular service.
 MarshalPivot getMarshalPivot()
           
 TxnManager getProxy()
           
 Uuid getReferentUuid()
          Returns the universally unique identifier that has been assigned to the resource this proxy represents.
 int getState(long id)
          Returns the current state of the given transaction.
 int getState(Object xid)
           
 Uuid getTransactionManagerId()
           
 int hashCode()
          Proxies for servers with the same proxyID have the same hash code.
 boolean isEmbeddedMgr()
           
 void join(long id, TransactionParticipant part, long crashCount)
          Join a transaction that is managed by this transaction manager.
 void join(long id, TransactionParticipant part, long crashCount, int partitionId, String clusterName)
           
 void join(long id, TransactionParticipant part, long crashCount, ServerTransaction userXtnObject)
          Deprecated. 
 void join(long id, TransactionParticipant part, long crashCount, ServerTransaction userXtnObject, int partitionId, String clusterName, Object clusterProxy)
           
 void join(Object id, TransactionParticipant part, long crashCount)
           
 void join(Object id, TransactionParticipant part, long crashCount, int partitionId, String clusterName)
           
 void join(Object id, TransactionParticipant part, long crashCount, ServerTransaction userXtnObject)
          Deprecated. 
 void join(Object id, TransactionParticipant part, long crashCount, ServerTransaction userXtnObject, int partitionId, String clusterName, Object clusterProxy)
           
 boolean needParticipantsJoin()
          returns true if this mgr which requires that the txn participants join into the txn in contrary to a mgr which the participants are known prior to txn propagation
 int prepare(Object xid)
          prepare the underlying xtn designated by the rendered xid
 void readExternal(ObjectInput in)
           
 void reenterPreparedExternalXid(Object xid, List<TransactionParticipant> parts)
          Retrieves a Transaction given the transaction's ID.
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

proxyID

public Uuid proxyID
The proxy's Uuid

Constructor Detail

TxnMgrProxy

public TxnMgrProxy()
Method Detail

create

public static TxnMgrProxy create(TxnManager txnMgr,
                                 TxnManager direct,
                                 Uuid id)

createLightProxy

public TxnMgrProxy createLightProxy()

create

public TransactionManager.Created create(long lease)
                                  throws LeaseDeniedException,
                                         RemoteException
Description copied from interface: TransactionManager
Begin a new top-level transaction.

Specified by:
create in interface TransactionManager
Parameters:
lease - the requested lease time for the transaction
Returns:
the transaction ID and the lease granted
Throws:
LeaseDeniedException - if this manager is unwilling to grant the requested lease time
RemoteException - if there is a communication error

join

public void join(long id,
                 TransactionParticipant part,
                 long crashCount)
          throws UnknownTransactionException,
                 CannotJoinException,
                 CrashCountException,
                 RemoteException
Description copied from interface: TransactionManager
Join a transaction that is managed by this transaction manager. The crashCount marks the state of the storage used by the participant for transactions. If the participant attempts to join a transaction more than once, the crash counts must be the same. Each system crash or other event that destroys the state of the participant's unprepared transaction storage must cause the crash count to increase by at least one.

Specified by:
join in interface TransactionManager
Parameters:
id - the transaction ID
part - the participant joining the transaction
crashCount - the participant's current crash count
Throws:
UnknownTransactionException - if the 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 the transaction is known to the manager but is no longer active.
CrashCountException - if the crash count provided for the participant differs from the crash count in a previous invocation of the same pairing of participant and transaction
RemoteException - if there is a communication error
See Also:
ServerTransaction.join(net.jini.core.transaction.server.TransactionParticipant, long)

disJoin

public boolean disJoin(long id,
                       TransactionParticipant part)
                throws UnknownTransactionException,
                       RemoteException
Description copied from interface: ExtendedTransactionManager
Remove a participant that was joined for a first time. called when a call to a participant returned empty so we can spare calling commit or abort on it, usually used in embedded mahalo

Specified by:
disJoin in interface ExtendedTransactionManager
Returns:
true if participant disjoined
Throws:
UnknownTransactionException
RemoteException
See Also:
TransactionParticipant

getState

public int getState(long id)
             throws UnknownTransactionException,
                    RemoteException
Description copied from interface: TransactionManager
Returns the current state of the given transaction. The returned state can be any of the TransactionConstants values.

Specified by:
getState in interface TransactionManager
Parameters:
id - the transaction ID
Returns:
an int representing the state of the transaction
Throws:
UnknownTransactionException - if the 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.
RemoteException - if there is a communication error
See Also:
ServerTransaction.getState(), TransactionConstants

commit

public void commit(long id)
            throws UnknownTransactionException,
                   CannotCommitException,
                   RemoteException
Description copied from interface: TransactionManager
Commit the transaction. Commit asks the transaction manager to execute the voting process with the participants. Returns if the transaction successfully reaches either the NOTCHANGED or the COMMITTED state, without waiting for the transaction manager to notify all participants of the decision. If the transaction must be aborted (because one or more participants are unable to prepare), CannotCommitException is thrown without waiting for the transaction manager to notify all participants of the decision.

Specified by:
commit in interface TransactionManager
Parameters:
id - the transaction ID
Throws:
UnknownTransactionException - if the 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.
CannotCommitException - if the transaction is being or already has been aborted
RemoteException - if there is a communication error

commit

public void commit(long id,
                   long waitFor)
            throws UnknownTransactionException,
                   CannotCommitException,
                   TimeoutExpiredException,
                   RemoteException
Description copied from interface: TransactionManager
Commit the transaction, waiting for participants to be notified of the decision. Commit asks the transaction manager to execute the voting process with the participants. Returns if the transaction successfully reaches either the NOTCHANGED or the COMMITTED state, and the transaction manager has notified all participants of the decision, before the specified timeout expires. If the transaction must be aborted (because one or more participants are unable to prepare), CannotCommitException is thrown if the transaction manager is able to notify all participants of the decision before the specified timeout expires. If the transaction manager reaches a decision, but is unable to notify all participants of that decision before the specified timeout expires, then TimeoutExpiredException is thrown. If the specified timeout expires before the transaction manager reaches a decision, TimeoutExpiredException is not thrown until the manager reaches a decision.

Specified by:
commit in interface TransactionManager
Parameters:
id - the transaction ID
waitFor - timeout to wait, from the start of the call until all participants have been notified of the transaction manager's decision
Throws:
UnknownTransactionException - if the 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.
CannotCommitException - if the transaction is being or already has been aborted
TimeoutExpiredException - if the transaction manager reaches a decision, but is unable to notify all participants of that decision before the specified timeout expires
RemoteException - if there is a communication error

abort

public void abort(long id)
           throws UnknownTransactionException,
                  CannotAbortException,
                  RemoteException
Description copied from interface: TransactionManager
Abort the transaction. This can be called at any time by any object holding a reference to the transaction. Abort asks the transaction manager to abort the transaction and to notify each participant of the decision, resulting in them rolling back any state changes made as part of the transaction. Returns as soon as the transaction manager records the abort decision, without waiting for the transaction manager to notify all participants of the decision.

Specified by:
abort in interface TransactionManager
Parameters:
id - the transaction ID
Throws:
UnknownTransactionException - if the 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.
CannotAbortException - if the transaction is known to have previously reached the COMMITTED state due to an earlier commit
RemoteException - if there is a communication error

abort

public void abort(long id,
                  long waitFor)
           throws UnknownTransactionException,
                  CannotAbortException,
                  TimeoutExpiredException,
                  RemoteException
Description copied from interface: TransactionManager
Abort the transaction, waiting for participants to be notified of the decision. This can be called at any time by any object holding a reference to the transaction. Abort asks the transaction manager to abort the transaction and to notify each participant of the decision, resulting in them rolling back any state changes made as part of the transaction. Returns if the transaction manager records the decision and is able to notify all participants of the decision before the specified timeout expires. If the transaction manager is unable to notify all participants of the decision before the specified timeout expires, then TimeoutExpiredException is thrown.

Specified by:
abort in interface TransactionManager
Parameters:
id - the transaction ID
waitFor - timeout to wait, from the start of the call until all participants have been notified of the transaction manager's decision
Throws:
UnknownTransactionException - if the 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.
CannotAbortException - if the transaction is known to have previously reached the COMMITTED state due to an earlier commit
TimeoutExpiredException - if the timeout expires before all participants have been notified
RemoteException - if there is a communication error

prepare

public int prepare(Object xid)
            throws CannotCommitException,
                   UnknownTransactionException,
                   RemoteException
Description copied from interface: ExtendedTransactionManager
prepare the underlying xtn designated by the rendered xid

Specified by:
prepare in interface ExtendedTransactionManager
Returns:
Throws:
UnknownTransactionException
RemoteException
CannotCommitException

commit

public void commit(Object xid)
            throws UnknownTransactionException,
                   CannotCommitException,
                   RemoteException
Specified by:
commit in interface ExtendedTransactionManager
Throws:
UnknownTransactionException
CannotCommitException
RemoteException

commit

public void commit(Object xid,
                   long waitFor)
            throws UnknownTransactionException,
                   CannotCommitException,
                   TimeoutExpiredException,
                   RemoteException
Specified by:
commit in interface ExtendedTransactionManager
Throws:
UnknownTransactionException
CannotCommitException
TimeoutExpiredException
RemoteException

abort

public void abort(Object xid)
           throws UnknownTransactionException,
                  CannotAbortException,
                  RemoteException
Specified by:
abort in interface ExtendedTransactionManager
Throws:
UnknownTransactionException
CannotAbortException
RemoteException

abort

public void abort(Object xid,
                  long waitFor)
           throws UnknownTransactionException,
                  CannotAbortException,
                  TimeoutExpiredException,
                  RemoteException
Specified by:
abort in interface ExtendedTransactionManager
Throws:
UnknownTransactionException
CannotAbortException
TimeoutExpiredException
RemoteException

create

public TransactionManager.Created create(Object xid,
                                         long lease)
                                  throws LeaseDeniedException,
                                         RemoteException
Specified by:
create in interface ExtendedTransactionManager
Throws:
LeaseDeniedException
RemoteException

getState

public int getState(Object xid)
             throws UnknownTransactionException,
                    RemoteException
Specified by:
getState in interface ExtendedTransactionManager
Throws:
UnknownTransactionException
RemoteException

join

public void join(Object id,
                 TransactionParticipant part,
                 long crashCount)
          throws UnknownTransactionException,
                 CannotJoinException,
                 CrashCountException,
                 RemoteException
Specified by:
join in interface ExtendedTransactionManager
Throws:
UnknownTransactionException
CannotJoinException
CrashCountException
RemoteException

join

@Deprecated
public void join(long id,
                            TransactionParticipant part,
                            long crashCount,
                            ServerTransaction userXtnObject)
          throws UnknownTransactionException,
                 CannotJoinException,
                 CrashCountException,
                 RemoteException
Deprecated. 

Specified by:
join in interface ExtendedTransactionManager
Throws:
UnknownTransactionException
CannotJoinException
CrashCountException
RemoteException

join

@Deprecated
public void join(Object id,
                            TransactionParticipant part,
                            long crashCount,
                            ServerTransaction userXtnObject)
          throws UnknownTransactionException,
                 CannotJoinException,
                 CrashCountException,
                 RemoteException
Deprecated. 

Specified by:
join in interface ExtendedTransactionManager
Throws:
UnknownTransactionException
CannotJoinException
CrashCountException
RemoteException

join

public void join(long id,
                 TransactionParticipant part,
                 long crashCount,
                 int partitionId,
                 String clusterName)
          throws UnknownTransactionException,
                 CannotJoinException,
                 CrashCountException,
                 RemoteException
Specified by:
join in interface ExtendedTransactionManager
Throws:
UnknownTransactionException
CannotJoinException
CrashCountException
RemoteException

join

public void join(Object id,
                 TransactionParticipant part,
                 long crashCount,
                 int partitionId,
                 String clusterName)
          throws UnknownTransactionException,
                 CannotJoinException,
                 CrashCountException,
                 RemoteException
Specified by:
join in interface ExtendedTransactionManager
Throws:
UnknownTransactionException
CannotJoinException
CrashCountException
RemoteException

join

public void join(long id,
                 TransactionParticipant part,
                 long crashCount,
                 ServerTransaction userXtnObject,
                 int partitionId,
                 String clusterName,
                 Object clusterProxy)
          throws UnknownTransactionException,
                 CannotJoinException,
                 CrashCountException,
                 RemoteException
Specified by:
join in interface ExtendedTransactionManager
Throws:
UnknownTransactionException
CannotJoinException
CrashCountException
RemoteException

join

public void join(Object id,
                 TransactionParticipant part,
                 long crashCount,
                 ServerTransaction userXtnObject,
                 int partitionId,
                 String clusterName,
                 Object clusterProxy)
          throws UnknownTransactionException,
                 CannotJoinException,
                 CrashCountException,
                 RemoteException
Specified by:
join in interface ExtendedTransactionManager
Throws:
UnknownTransactionException
CannotJoinException
CrashCountException
RemoteException

reenterPreparedExternalXid

public void reenterPreparedExternalXid(Object xid,
                                       List<TransactionParticipant> parts)
                                throws RemoteException,
                                       CannotCommitException
Retrieves a Transaction given the transaction's ID.

Parameters:
id - the id
Throws:
RemoteException
CannotCommitException

getAdmin

public Object getAdmin()
                throws RemoteException
Description copied from interface: Administrable
Returns an object that implements whatever administration interfaces are appropriate for the particular service.

Specified by:
getAdmin in interface Administrable
Returns:
an object that implements whatever administration interfaces are appropriate for the particular service.
Throws:
RemoteException
See Also:
JoinAdmin

getReferentUuid

public Uuid getReferentUuid()
Returns the universally unique identifier that has been assigned to the resource this proxy represents.

Specified by:
getReferentUuid in interface ReferentUuid
Returns:
the instance of Uuid that is associated with the resource this proxy represents. This method will not return null.
See Also:
ReferentUuid

hashCode

public int hashCode()
Proxies for servers with the same proxyID have the same hash code.

Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Proxies for servers with the same proxyID are considered equal.

Overrides:
equals in class Object

getProxy

public TxnManager getProxy()

needParticipantsJoin

public boolean needParticipantsJoin()
returns true if this mgr which requires that the txn participants join into the txn in contrary to a mgr which the participants are known prior to txn propagation

Specified by:
needParticipantsJoin in interface TransactionManager
Returns:
true if its a mgr which requires the txn participants to join

isEmbeddedMgr

public boolean isEmbeddedMgr()

writeExternal

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

readExternal

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

getMarshalPivot

public MarshalPivot getMarshalPivot()
                             throws RemoteException
Specified by:
getMarshalPivot in interface MarshalPivotProvider
Throws:
RemoteException

toString

public String toString()
Overrides:
toString in class Object

getTransactionManagerId

public Uuid getTransactionManagerId()
                             throws RemoteException
Specified by:
getTransactionManagerId in interface TransactionManager
Throws:
RemoteException

GigaSpaces XAP 10.0.1 API

Copyright © GigaSpaces.