org.objectweb.jotm
Class ControlImpl

java.lang.Object
  |
  +--javax.rmi.PortableRemoteObject
        |
        +--org.objectweb.jotm.ControlImpl
All Implemented Interfaces:
Control, Coordinator, RecoveryCoordinator, Remote, Resource, Terminator, org.objectweb.jonas_timer.TimerEventListener

public class ControlImpl
extends PortableRemoteObject
implements Control, Resource, Coordinator, Terminator, RecoveryCoordinator, org.objectweb.jonas_timer.TimerEventListener

Implementation of the object that represents a transaction. This remote object has been created by a TransactionFactory. It extends The RemoteControl Remote Interface

See Also:
TransactionFactory

Field Summary
 
Fields inherited from interface org.objectweb.jotm.Resource
VOTE_COMMIT, VOTE_READONLY, VOTE_ROLLBACK
 
Method Summary
 void commit_one_phase()
          Sub-coordinator received commit_one_phase from its superior.
 void commit()
          Sub-coordinator received commit from its superior.
 void commit(boolean report_heuristics)
          Commits this transaction
 void forget()
          forget transaction
 Coordinator get_coordinator()
          Gets the Coordinator object for this transaction
 int get_status()
          Gets the current status of this transaction
 Terminator get_terminator()
          Gets the Terminator object for this transaction
 String get_transaction_name()
          Gets a String that represents the transaction name.
 boolean is_same_transaction(Coordinator tc)
          Tests if the given coordinator represents this transaction
 int prepare()
          Sub-coordinator has received prepare from its superior.
 RecoveryCoordinator register_resource(Resource res)
          Registers a Resource object for this transaction
 void register_synchronization(RemoteSynchro sync)
          Registers a Synchronization object for this transaction
 int replay_completion(Resource res)
          Asks the status of this transaction, after recovery of a Resource
 void rollback_only()
          Asks to rollback the transaction
 void rollback()
          Rolls back this transaction branch.
 void timeoutExpired(Object arg)
          The transaction timeout has expired Do not synchronize this method to avoid deadlocks!
 
Methods inherited from class javax.rmi.PortableRemoteObject
connect, exportObject, narrow, toStub, unexportObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get_terminator

public Terminator get_terminator()
                          throws RemoteException
Gets the Terminator object for this transaction

Specified by:
get_terminator in interface Control
Returns:
Terminator for this transaction
Throws:
RemoteException - if a remote exception occurs

get_coordinator

public Coordinator get_coordinator()
                            throws RemoteException
Gets the Coordinator object for this transaction

Specified by:
get_coordinator in interface Control
Returns:
Coordinator for this transaction
Throws:
RemoteException - if a remote exception occurs

get_status

public int get_status()
               throws RemoteException
Gets the current status of this transaction

Specified by:
get_status in interface Coordinator
Returns:
current transaction status
Throws:
RemoteException - if a remote exception occurs

is_same_transaction

public boolean is_same_transaction(Coordinator tc)
                            throws RemoteException
Tests if the given coordinator represents this transaction

Specified by:
is_same_transaction in interface Coordinator
Parameters:
tc - Coordinator
Returns:
true if it is the same transaction
Throws:
RemoteException - if a remote exception occurs

register_resource

public RecoveryCoordinator register_resource(Resource res)
                                      throws RemoteException
Registers a Resource object for this transaction

Specified by:
register_resource in interface Coordinator
Parameters:
res - Resource to be registered
Returns:
RecoveryCoordinator used for replay_completion
Throws:
RemoteException - if a remote exception occurs

register_synchronization

public void register_synchronization(RemoteSynchro sync)
                              throws RemoteException
Registers a Synchronization object for this transaction

Specified by:
register_synchronization in interface Coordinator
Parameters:
sync - RemoteSynchro to be registered
Throws:
RemoteException - if a remote exception occurs

rollback_only

public void rollback_only()
                   throws RemoteException
Asks to rollback the transaction

Specified by:
rollback_only in interface Coordinator
Throws:
RemoteException - if a remote exception occurs

get_transaction_name

public String get_transaction_name()
                            throws RemoteException
Gets a String that represents the transaction name. Only the Format Id and the Global Id are used to build it : The Branch Qualifier is not used.

Specified by:
get_transaction_name in interface Coordinator
Returns:
Transaction Name
Throws:
RemoteException - if a remote exception occurs

commit

public void commit(boolean report_heuristics)
            throws RemoteException
Commits this transaction

Specified by:
commit in interface Terminator
Parameters:
report_heuristics - want to report heuristics if any
Throws:
TransactionRolledbackException - the transaction has been rolled back
HeuristicMixed - Resources have rolled back
HeuristicHazard - Resources may have rolled back
RemoteException - if a remote exception occurs

rollback

public void rollback()
              throws RemoteException
Rolls back this transaction branch. Can be a sub-coordinator or a normal coordinator.

Specified by:
rollback in interface Resource
Throws:
RemoteException - if a remote exception occurs

prepare

public int prepare()
            throws RemoteException
Sub-coordinator has received prepare from its superior. It must more or less do the same things that the phase 1 of the 2PC.

Specified by:
prepare in interface Resource
Returns:
Vote : commit, roollback or read-only.
RemoteException

commit

public void commit()
            throws RemoteException
Sub-coordinator received commit from its superior. It must more or less do the same things that the phase 2 of the 2PC.

Specified by:
commit in interface Resource
RemoteException

commit_one_phase

public void commit_one_phase()
                      throws RemoteException
Sub-coordinator received commit_one_phase from its superior. It is more or less a Terminator.commit().

Specified by:
commit_one_phase in interface Resource
RemoteException

forget

public void forget()
            throws RemoteException
forget transaction

Specified by:
forget in interface Resource
RemoteException

replay_completion

public int replay_completion(Resource res)
                      throws RemoteException
Asks the status of this transaction, after recovery of a Resource

Specified by:
replay_completion in interface RecoveryCoordinator
Parameters:
res - Resource recovering
RemoteException

timeoutExpired

public void timeoutExpired(Object arg)
The transaction timeout has expired Do not synchronize this method to avoid deadlocks!

Specified by:
timeoutExpired in interface org.objectweb.jonas_timer.TimerEventListener