org.objectweb.jonas_tm
Class ControlImpl

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--org.objectweb.common.RemoteObject
                          |
                          +--org.objectweb.jonas_tm.ControlImpl
All Implemented Interfaces:
Control, Coordinator, RecoveryCoordinator, java.rmi.Remote, Resource, java.io.Serializable, Terminator, TimerEventListener

public class ControlImpl
extends RemoteObject
implements Control, Coordinator, RecoveryCoordinator, Terminator, Resource, TimerEventListener

Implementation of the object that represents a transaction. This remote object has been created by a TransactionFactory.

Author:
Philippe Durieux Contributor(s): 02/01/15 Dean Jennings - ArrayList for resourceList and synchronizationList
See Also:
TransactionFactory, Serialized Form

Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface org.objectweb.jonas_tm.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
 java.lang.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(java.lang.Object arg)
          The transaction timeout has expired Do not synchronize this method to avoid deadlocks!
 
Methods inherited from class org.objectweb.common.RemoteObject
getPort, setPort
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

get_terminator

public Terminator get_terminator()
                          throws java.rmi.RemoteException
Gets the Terminator object for this transaction
Specified by:
get_terminator in interface Control
Returns:
Terminator for this transaction

get_coordinator

public Coordinator get_coordinator()
                            throws java.rmi.RemoteException
Gets the Coordinator object for this transaction
Specified by:
get_coordinator in interface Control
Returns:
Coordinator for this transaction

get_status

public int get_status()
               throws java.rmi.RemoteException
Gets the current status of this transaction
Specified by:
get_status in interface Coordinator
Returns:
current transaction status

is_same_transaction

public boolean is_same_transaction(Coordinator tc)
                            throws java.rmi.RemoteException
Tests if the given coordinator represents this transaction
Specified by:
is_same_transaction in interface Coordinator
Parameters:
Coordinator - Coordinator to be compared to this transaction
Returns:
true if it is the same transaction

register_resource

public RecoveryCoordinator register_resource(Resource res)
                                      throws java.rmi.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

register_synchronization

public void register_synchronization(RemoteSynchro sync)
                              throws java.rmi.RemoteException
Registers a Synchronization object for this transaction
Specified by:
register_synchronization in interface Coordinator
Parameters:
sync - RemoteSynchro to be registered

rollback_only

public void rollback_only()
                   throws java.rmi.RemoteException
Asks to rollback the transaction
Specified by:
rollback_only in interface Coordinator

get_transaction_name

public java.lang.String get_transaction_name()
                                      throws java.rmi.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

commit

public void commit(boolean report_heuristics)
            throws java.rmi.RemoteException
Commits this transaction
Specified by:
commit in interface Terminator
Parameters:
report_heuristics - want to report heuristics if any
Throws:
javax.transaction.TransactionRolledbackException - the transaction has been rolled back
HeuristicMixed - Resources have rolled back
HeuristicHazard - Resources may have rolled back

rollback

public void rollback()
              throws java.rmi.RemoteException
Rolls back this transaction branch. Can be a sub-coordinator or a normal coordinator.
Specified by:
rollback in interface Terminator

prepare

public int prepare()
            throws java.rmi.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.

commit

public void commit()
            throws java.rmi.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

commit_one_phase

public void commit_one_phase()
                      throws java.rmi.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

forget

public void forget()
            throws java.rmi.RemoteException
forget transaction
Specified by:
forget in interface Resource

replay_completion

public int replay_completion(Resource res)
                      throws java.rmi.RemoteException
Asks the status of this transaction, after recovery of a Resource
Specified by:
replay_completion in interface RecoveryCoordinator
Parameters:
res - Resource recovering

timeoutExpired

public void timeoutExpired(java.lang.Object arg)
The transaction timeout has expired Do not synchronize this method to avoid deadlocks!
Specified by:
timeoutExpired in interface TimerEventListener