org.objectweb.jotm

Class ControlImpl

Implemented Interfaces:
Control, Remote, Coordinator, RecoveryCoordinator, Resource, Terminator, TimerEventListener

public class ControlImpl
extends PortableRemoteObject
implements Control, Resource, Coordinator, Terminator, RecoveryCoordinator, 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

Fields inherited from interface org.objectweb.jotm.Resource

VOTE_COMMIT, VOTE_READONLY, VOTE_ROLLBACK

Method Summary

void
commit()
Sub-coordinator received commit from its superior.
void
commit(boolean report_heuristics)
Commits this transaction
void
commit_one_phase()
Sub-coordinator received commit_one_phase from its superior.
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()
Rolls back this transaction branch.
void
rollback_only()
Asks to rollback the transaction
void
timeoutExpired(Object arg)
The transaction timeout has expired Do not synchronize this method to avoid deadlocks!

Method Details

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


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


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


forget

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


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


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


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


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


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 to be compared to this transaction

Returns:
true if it is the same transaction


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.


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


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


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


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
rollback in interface Terminator


rollback_only

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


timeoutExpired

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