org.openorb.ots.Impl
Class SubTransCoordinator

java.lang.Object
  extended byorg.omg.PortableServer.Servant
      extended byorg.omg.CosTransactions.CoordinatorPOA
          extended byorg.openorb.ots.Impl.Coordinator
              extended byorg.openorb.ots.Impl.SubTransCoordinator
All Implemented Interfaces:
CoordinatorOperations, org.omg.CORBA.portable.InvokeHandler

public class SubTransCoordinator
extends Coordinator

This class is a coordinator implementation for an sub transaction.

Author:
Jerome Daniel

Constructor Summary
SubTransCoordinator(Manager manager, int time_out, XID xid, TransIdentity[] parents, org.omg.PortableServer.POA poa, Logger logger)
          Constructor
 
Method Summary
 Control create_subtransaction()
          A new subtransaction is created whose parent is the transaction associated with the target object.
 Status get_parent_status()
          If the transaction associated with the target object is a top-level transaction, then this operation is equivalent to the get_status operation.
 Status get_top_level_status()
          This operation returns the status of the top-level ancestor of the transaction associated with the target object.
 java.lang.String get_transaction_name()
          This operation returns a printable string describing the transaction associated with the target object.
 TransIdentity[] getParents()
           
 int hash_top_level_tran()
          This operation returns the hash code for the top-level ancestor of the transaction associated with the target object.
 boolean is_ancestor_transaction(Coordinator tc)
          This operation returns true if, and only if, the transaction associated with the target object is an ancestor of the transaction associated with the parameter object.
 boolean is_related_transaction(Coordinator tc)
          This operation returns true if, and only if, the transaction associated with the target object is related to the transaction associated with the parameter object.
 boolean is_top_level_transaction()
          This operation returns true if, and only if, the transaction associated with the target object is a top-level transaction.
 RecoveryCoordinator register_resource(Resource r)
          This operation registers the specified resource as a participant in the transaction associated with the target object.
 void register_subtran_aware(SubtransactionAwareResource r)
          This operation registers the specified subtransaction aware resource such that it will be notified when the subtransaction has committed or rolled back.
 SubtransactionAwareResource[] subtran_resources()
          This operation returns all registered resources.
 
Methods inherited from class org.openorb.ots.Impl.Coordinator
commit_sub_transactions, desynchronize, get_status, get_txcontext, getXID, hash_transaction, is_descendant_transaction, is_same_transaction, register_synchronization, remove_subtran_listener, removeItself, resources, rollback_only, rollback_sub_transactions, setStatus, setTerminator, synchronize, updatePropagationContext
 
Methods inherited from class org.omg.CosTransactions.CoordinatorPOA
_all_interfaces, _invoke, _this, _this
 
Methods inherited from class org.omg.PortableServer.Servant
_default_POA, _get_delegate, _get_interface_def, _is_a, _non_existent, _object_id, _orb, _poa, _set_delegate, _this_object, _this_object
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubTransCoordinator

public SubTransCoordinator(Manager manager,
                           int time_out,
                           XID xid,
                           TransIdentity[] parents,
                           org.omg.PortableServer.POA poa,
                           Logger logger)
Constructor

Method Detail

getParents

public TransIdentity[] getParents()

get_parent_status

public Status get_parent_status()
If the transaction associated with the target object is a top-level transaction, then this operation is equivalent to the get_status operation. Otherwise, this operation returns the status of the parent of the transaction associated with the target object.

Specified by:
get_parent_status in interface CoordinatorOperations
Overrides:
get_parent_status in class Coordinator

get_top_level_status

public Status get_top_level_status()
This operation returns the status of the top-level ancestor of the transaction associated with the target object. If the transaction is a top-level transaction, then this operation is equivalent to the get_status operation.

Specified by:
get_top_level_status in interface CoordinatorOperations
Overrides:
get_top_level_status in class Coordinator

is_related_transaction

public boolean is_related_transaction(Coordinator tc)
This operation returns true if, and only if, the transaction associated with the target object is related to the transaction associated with the parameter object.

Specified by:
is_related_transaction in interface CoordinatorOperations
Overrides:
is_related_transaction in class Coordinator

is_ancestor_transaction

public boolean is_ancestor_transaction(Coordinator tc)
This operation returns true if, and only if, the transaction associated with the target object is an ancestor of the transaction associated with the parameter object.

Specified by:
is_ancestor_transaction in interface CoordinatorOperations
Overrides:
is_ancestor_transaction in class Coordinator

is_top_level_transaction

public boolean is_top_level_transaction()
This operation returns true if, and only if, the transaction associated with the target object is a top-level transaction. A transaction is a top-level transaction if it has no parent.

Specified by:
is_top_level_transaction in interface CoordinatorOperations
Overrides:
is_top_level_transaction in class Coordinator

hash_top_level_tran

public int hash_top_level_tran()
This operation returns the hash code for the top-level ancestor of the transaction associated with the target object. This operation is equivalent to the hash_transaction operation when the transaction associated with the target object is a top-level transaction.

Specified by:
hash_top_level_tran in interface CoordinatorOperations
Overrides:
hash_top_level_tran in class Coordinator

get_transaction_name

public java.lang.String get_transaction_name()
This operation returns a printable string describing the transaction associated with the target object. The returned string is intended to support debugging.

Specified by:
get_transaction_name in interface CoordinatorOperations
Overrides:
get_transaction_name in class Coordinator

register_resource

public RecoveryCoordinator register_resource(Resource r)
                                      throws Inactive
This operation registers the specified resource as a participant in the transaction associated with the target object. When the transaction is terminated, the resource will receive requests to commit or rollback the updates performed as part of the transaction. These requests are described in the description of the Resource interface. The Inactive exception is raised if the transaction has already been prepared. The standard exception TRANSACTION_ROLLEDBACK may be raised if the transaction has been marked rollback only. If the resource is a subtransaction aware resource (it supports the SubtransactionAwareResource interface) and the transaction associated with the target object is a subtransaction, then this operation registers the specified resource with the subtransaction and indirectly with the top-level transaction when the subtransaction?s ancestors have completed. Otherwise, the resource is registered as a participant in the current transaction. If the current transaction is a subtransaction, the resource will not receive prepare or commit requests until the top-level ancestor terminates. This operation returns a RecoveryCoordinator that can be used by this resource during recovery.

Specified by:
register_resource in interface CoordinatorOperations
Overrides:
register_resource in class Coordinator
Throws:
Inactive

register_subtran_aware

public void register_subtran_aware(SubtransactionAwareResource r)
                            throws Inactive,
                                   NotSubtransaction
This operation registers the specified subtransaction aware resource such that it will be notified when the subtransaction has committed or rolled back. These requests are described in the description of the SubtransactionAwareResource interface. Note that this operation registers the specified resource only with the subtransaction. This operation cannot be used to register the resource as a participant in the transaction. The NotSubtransaction exception is raised if the current transaction is not a subtransaction. The Inactive exception is raised if the subtransaction (or any ancestor) has already been terminated. The standard exception TRANSACTION_ROLLEDBACK may be raised if the subtransaction (or any ancestor) has been marked rollback only.

Specified by:
register_subtran_aware in interface CoordinatorOperations
Overrides:
register_subtran_aware in class Coordinator
Throws:
Inactive
NotSubtransaction

create_subtransaction

public Control create_subtransaction()
                              throws SubtransactionsUnavailable,
                                     Inactive
A new subtransaction is created whose parent is the transaction associated with the target object. The Inactive exception is raised if the target transaction has already been prepared. An implementation of the Transaction Service is not required to support nested transactions. If nested transactions are not supported, the exception SubtransactionsUnavailable is raised. The create_subtransaction operation returns a Control object, which enables the subtransaction to be terminated and allows recoverable objects to participate in the subtransaction. An implementation of the Transaction Service may restrict the ability for the Control object to be transmitted to or used in other execution environments.

Specified by:
create_subtransaction in interface CoordinatorOperations
Overrides:
create_subtransaction in class Coordinator
Throws:
SubtransactionsUnavailable
Inactive

subtran_resources

public SubtransactionAwareResource[] subtran_resources()
This operation returns all registered resources.

Overrides:
subtran_resources in class Coordinator