Package com.sun.jts.CosTransactions
Class TopCoordinator
- java.lang.Object
-
- org.omg.PortableServer.Servant
-
- com.sun.jts.codegen.otsidl.JCoordinatorPOA
-
- com.sun.jts.CosTransactions.TopCoordinator
-
- All Implemented Interfaces:
JCoordinator,JCoordinatorOperations,Serializable,org.omg.CORBA.Object,org.omg.CORBA.portable.IDLEntity,org.omg.CORBA.portable.InvokeHandler,org.omg.CosTransactions.Coordinator,org.omg.CosTransactions.CoordinatorOperations
public class TopCoordinator extends JCoordinatorPOA
The TopCoordinator interface is our implementation of the standard Coordinator interface that is used for top-level transactions. It allows Resources to be registered for participation in a top-level transaction. In addition the TopCoordinator recovery interface can be used if the connection to a superior Coordinator is lost after a transaction is prepared. As an instance of this class may be accessed from multiple threads within a process, serialisation for thread-safety is necessary in the implementation. The information managed should be reconstructible in the case of a failure.- Version:
- 0.02
- Author:
- Simon Holdsworth, IBM Corporation
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.omg.CORBA.Request_create_request(org.omg.CORBA.Context ctx, String operation, org.omg.CORBA.NVList arg_list, org.omg.CORBA.NamedValue result)org.omg.CORBA.Request_create_request(org.omg.CORBA.Context ctx, String operation, org.omg.CORBA.NVList arg_list, org.omg.CORBA.NamedValue result, org.omg.CORBA.ExceptionList exceptions, org.omg.CORBA.ContextList contexts)org.omg.CORBA.Object_duplicate()org.omg.CORBA.DomainManager[]_get_domain_managers()org.omg.CORBA.Object_get_interface_def()org.omg.CORBA.Policy_get_policy(int policy_type)int_hash(int maximum)boolean_is_a(String repository_id)boolean_is_equivalent(org.omg.CORBA.Object that)boolean_non_existent()void_release()org.omg.CORBA.Request_request(String operation)org.omg.CORBA.Object_set_policy_override(org.omg.CORBA.Policy[] policies, org.omg.CORBA.SetOverrideType set_add)org.omg.CosTransactions.Controlcreate_subtransaction()Creates a subtransaction and returns a Control object that represents the child transaction.voiddoFinalize()Cleans up the objects state.booleanequals(Object other)Determines equality of the object with the parameter.org.omg.CosTransactions.Statusget_parent_status()Gets the local state of the transaction.org.omg.CosTransactions.Statusget_status()Returns the local status of the target transaction.org.omg.CosTransactions.Statusget_top_level_status()Gets the local state of the transaction.Stringget_transaction_name()Returns a printable string that represents the TopCoordinator.org.omg.CosTransactions.PropagationContextget_txcontext()Creates a PropagationContext which contains the information which would normally be passed implicitly via the CosTSPropagation interfaces.org.omg.CosTransactions.TransIdentity[]getAncestors()Returns the sequence of ancestors of the transaction.GlobalTIDgetGlobalTid()org.omg.CosTransactions.otid_tgetGlobalTID()Returns a global identifier that represents the TopCoordinator's transaction.longgetLocalTID()Returns the internal identifier for the transaction.intgetParticipantCount()inthash_top_level_tran()Returns a hash value based on the top-level ancestor of the transaction associated with the target object.inthash_transaction()Returns a hash value based on the transaction associated with the target object.inthashCode()Returns a hash code for the object.booleanis_ancestor_transaction(org.omg.CosTransactions.Coordinator other)Determines whether the target TopCoordinator is an ancestor of the given Coordinator.booleanis_descendant_transaction(org.omg.CosTransactions.Coordinator other)Determines whether the target TopCoordinator is a descendant of the given Coordinator.booleanis_related_transaction(org.omg.CosTransactions.Coordinator other)Determines whether the target TopCoordinator is related to the given Coordinator (i.e.booleanis_root_transaction()Determines whether this TopCoordinator is the root TopCoordinator.booleanis_same_transaction(org.omg.CosTransactions.Coordinator other)Compares the given Coordinator object with the target, and returns TRUE if they represent the same transaction.booleanis_top_level_transaction()Determines whether the target TopCoordinator represents a top-level (non-nested) transaction.booleanisRollbackOnly()Checks whether the TopCoordinator is marked rollback-only.org.omg.CosTransactions.RecoveryCoordinatorregister_resource(org.omg.CosTransactions.Resource res)Enables a Resource to be registered as a participant in the completion of the top-level transaction represented by the TopCoordinator.voidregister_subtran_aware(org.omg.CosTransactions.SubtransactionAwareResource sares)Enables a SubtransactionAwareResource to be registered as a participant in the completion of a subtransaction.voidregister_synchronization(org.omg.CosTransactions.Synchronization sync)Informs the TopCoordinator that the given object requires synchronization before and after completion of the transaction.voidrollback_only()Ensures that the transaction represented by the target TopCoordinator cannot be committed.-
Methods inherited from class com.sun.jts.codegen.otsidl.JCoordinatorPOA
_all_interfaces, _invoke, _this, _this
-
-
-
-
Method Detail
-
doFinalize
public void doFinalize()
Cleans up the objects state.
-
get_status
public org.omg.CosTransactions.Status get_status()
Returns the local status of the target transaction.- Specified by:
get_statusin interfaceorg.omg.CosTransactions.CoordinatorOperations- Returns:
- The status of the transaction.
-
get_parent_status
public org.omg.CosTransactions.Status get_parent_status()
Gets the local state of the transaction. For a top-level transaction this operation is equivalent to the get_status method. This operation references no instance variables and so can be implemented locally in the proxy class.- Specified by:
get_parent_statusin interfaceorg.omg.CosTransactions.CoordinatorOperations- Returns:
- The status of the transaction.
-
get_top_level_status
public org.omg.CosTransactions.Status get_top_level_status()
Gets the local state of the transaction. For a top-level transaction this operation is equivalent to the get_status method. This operation references no instance variables and so can be implemented locally in a proxy class.- Specified by:
get_top_level_statusin interfaceorg.omg.CosTransactions.CoordinatorOperations- Returns:
- The status of the transaction.
-
is_same_transaction
public boolean is_same_transaction(org.omg.CosTransactions.Coordinator other) throws org.omg.CORBA.SystemExceptionCompares the given Coordinator object with the target, and returns TRUE if they represent the same transaction. This operation needs to be implemented in an efficient manner, without any cross-process calls. This could be achieved by including the global identifier in the Coordinator references and comparing them. This operation references no instance variables and so can be implemented locally in a proxy class.- Specified by:
is_same_transactionin interfaceorg.omg.CosTransactions.CoordinatorOperations- Parameters:
other- The other Coordinator to be compared.- Returns:
- Indicates equality of the transactions the objects represent.
- Throws:
org.omg.CORBA.SystemException- The other Coordinator could not be reached.
-
is_related_transaction
public boolean is_related_transaction(org.omg.CosTransactions.Coordinator other) throws org.omg.CORBA.SystemExceptionDetermines whether the target TopCoordinator is related to the given Coordinator (i.e. is a member of the same transaction family). For a top-level transaction returns TRUE if and only if the transaction associated with the parameter object is a descendant of the transaction associated with the target object. This operation references no instance variables and so can be implemented locally in a proxy class.- Specified by:
is_related_transactionin interfaceorg.omg.CosTransactions.CoordinatorOperations- Parameters:
other- The other Coordinator.- Returns:
- Indicates the relationship.
- Throws:
org.omg.CORBA.SystemException- The other Coordinator could not be reached.
-
is_root_transaction
public boolean is_root_transaction()
Determines whether this TopCoordinator is the root TopCoordinator. the given Coordinator (i.e. is a member of the same transaction family). For a root transaction, this method returns TRUE. Otherwise it returns FALSE.- Returns:
- Indicates if this is the root TopCoordinator.
-
is_ancestor_transaction
public boolean is_ancestor_transaction(org.omg.CosTransactions.Coordinator other) throws org.omg.CORBA.SystemExceptionDetermines whether the target TopCoordinator is an ancestor of the given Coordinator. For a top-level transaction returns TRUE if and only if the transaction associated with the target object is an ancestor of the transaction associated with the parameter object. This operation references no instance variables and so can be implemented locally in a proxy class.- Specified by:
is_ancestor_transactionin interfaceorg.omg.CosTransactions.CoordinatorOperations- Parameters:
other- The other Coordinator.- Returns:
- Indicates the relationship.
- Throws:
org.omg.CORBA.SystemException- The other Coordinator could not be reached.
-
is_descendant_transaction
public boolean is_descendant_transaction(org.omg.CosTransactions.Coordinator other) throws org.omg.CORBA.SystemExceptionDetermines whether the target TopCoordinator is a descendant of the given Coordinator. For a top-level transaction returns TRUE if and only if the transaction associated with the target object is the same as the transaction associated with the parameter object. This operation references no instance variables and so can be implemented locally in a proxy class.- Specified by:
is_descendant_transactionin interfaceorg.omg.CosTransactions.CoordinatorOperations- Parameters:
other- The other Coordinator.- Returns:
- Indicates the relationship.
- Throws:
org.omg.CORBA.SystemException- The other Coordinator could not be reached.
-
is_top_level_transaction
public boolean is_top_level_transaction()
Determines whether the target TopCoordinator represents a top-level (non-nested) transaction.For a top-level transaction returns TRUE.
This operation references no instance variables and so can be implemented locally in a proxy class.
- Specified by:
is_top_level_transactionin interfaceorg.omg.CosTransactions.CoordinatorOperations- Returns:
- Indicates this is a top-level transaction.
-
hash_transaction
public int hash_transaction()
Returns a hash value based on the transaction associated with the target object. This operation references only the global TID, and so can be implemented locally in a proxy class.- Specified by:
hash_transactionin interfaceorg.omg.CosTransactions.CoordinatorOperations- Returns:
- The hash value for the transaction.
-
hash_top_level_tran
public int hash_top_level_tran()
Returns a hash value based on the top-level ancestor of the transaction associated with the target object. This operation references only the global TID, and so can be implemented locally in a proxy class.- Specified by:
hash_top_level_tranin interfaceorg.omg.CosTransactions.CoordinatorOperations- Returns:
- The hash value for the transaction.
-
register_resource
public org.omg.CosTransactions.RecoveryCoordinator register_resource(org.omg.CosTransactions.Resource res) throws org.omg.CosTransactions.Inactive, org.omg.CORBA.TRANSACTION_ROLLEDBACKEnables a Resource to be registered as a participant in the completion of the top-level transaction represented by the TopCoordinator. If the TopCoordinator is a subordinate, and has not registered with its superior, it creates a CoordinatorResource and registers it. The RecoveryCoordinator that is returned is stored in the SuperiorInfo.- Specified by:
register_resourcein interfaceorg.omg.CosTransactions.CoordinatorOperations- Parameters:
res- The Resource to be registered.- Returns:
- The RecoveryCoordinator object from the registration with the top-level ancestor.
- Throws:
org.omg.CosTransactions.Inactive- The Coordinator is completing the transaction and cannot accept this registration.org.omg.CORBA.TRANSACTION_ROLLEDBACK- The transaction which the Coordinator represents has already been rolled back, or has been marked rollback-only.
-
register_subtran_aware
public void register_subtran_aware(org.omg.CosTransactions.SubtransactionAwareResource sares) throws org.omg.CosTransactions.NotSubtransactionEnables a SubtransactionAwareResource to be registered as a participant in the completion of a subtransaction. For a top-level transaction this raises the NotSubtransaction exception.- Specified by:
register_subtran_awarein interfaceorg.omg.CosTransactions.CoordinatorOperations- Parameters:
sares- The SubtransactionAwareResource to be registered.- Throws:
org.omg.CosTransactions.NotSubtransaction- The Coordinator represents a top-level transaction and cannot accept the registration.
-
rollback_only
public void rollback_only() throws org.omg.CosTransactions.InactiveEnsures that the transaction represented by the target TopCoordinator cannot be committed.- Specified by:
rollback_onlyin interfaceorg.omg.CosTransactions.CoordinatorOperations- Throws:
org.omg.CosTransactions.Inactive- The Coordinator is already completing the transaction.
-
get_transaction_name
public String get_transaction_name()
Returns a printable string that represents the TopCoordinator. This operation references only the global TID, and so can be implemented locally in a proxy class.- Specified by:
get_transaction_namein interfaceorg.omg.CosTransactions.CoordinatorOperations- Returns:
- The transaction name.
-
create_subtransaction
public org.omg.CosTransactions.Control create_subtransaction() throws org.omg.CosTransactions.InactiveCreates a subtransaction and returns a Control object that represents the child transaction.- Specified by:
create_subtransactionin interfaceorg.omg.CosTransactions.CoordinatorOperations- Returns:
- The Control object for the new child transaction.
- Throws:
org.omg.CosTransactions.Inactive- The Coordinator is completing the subtransaction and cannot create a new child.
-
getGlobalTID
public org.omg.CosTransactions.otid_t getGlobalTID()
Returns a global identifier that represents the TopCoordinator's transaction.This operation references only the global identifier, and so can be implemented locally in a proxy class.
This method is currently not synchronized because that causes a deadlock in resync. I don't think this is a problem as the global identifier is allocated in the constructor and then never changes.
- Specified by:
getGlobalTIDin interfaceJCoordinatorOperations- Returns:
- The global transaction identifier.
-
getGlobalTid
public GlobalTID getGlobalTid()
-
getParticipantCount
public int getParticipantCount()
-
getLocalTID
public long getLocalTID()
Returns the internal identifier for the transaction. This method is currently not synchronized because that causes a deadlock in resync.- Specified by:
getLocalTIDin interfaceJCoordinatorOperations- Returns:
- The local identifier.
-
isRollbackOnly
public boolean isRollbackOnly()
Checks whether the TopCoordinator is marked rollback-only.- Specified by:
isRollbackOnlyin interfaceJCoordinatorOperations- Returns:
- Indicates whether the transaction is rollback-only.
-
getAncestors
public org.omg.CosTransactions.TransIdentity[] getAncestors()
Returns the sequence of ancestors of the transaction.- Specified by:
getAncestorsin interfaceJCoordinatorOperations- Returns:
- The sequence of ancestors.
-
register_synchronization
public void register_synchronization(org.omg.CosTransactions.Synchronization sync) throws org.omg.CORBA.SystemException, org.omg.CosTransactions.Inactive, org.omg.CosTransactions.SynchronizationUnavailableInforms the TopCoordinator that the given object requires synchronization before and after completion of the transaction. If possible, a CoordinatorSync object is registered with the superior Coordinator. Otherwise this Coordinator becomes the root of a sub-tree for synchronization.- Specified by:
register_synchronizationin interfaceorg.omg.CosTransactions.CoordinatorOperations- Parameters:
sync- The Synchronization object to be registered.- Throws:
org.omg.CosTransactions.Inactive- The Coordinator is in the process of completing the transaction and cannot accept this registration.org.omg.CosTransactions.SynchronizationUnavailable- The transaction service cannot support synchronization.org.omg.CORBA.SystemException- The operation failed.
-
get_txcontext
public org.omg.CosTransactions.PropagationContext get_txcontext() throws org.omg.CosTransactions.UnavailableCreates a PropagationContext which contains the information which would normally be passed implicitly via the CosTSPropagation interfaces.- Specified by:
get_txcontextin interfaceorg.omg.CosTransactions.CoordinatorOperations- Returns:
- The transaction context.
- Throws:
org.omg.CosTransactions.Unavailable- The Coordinator is in the process of completing the transaction and cannot return the information.
-
hashCode
public int hashCode()
Returns a hash code for the object.This very basic method is used by the trace facility and should not call any method which is traced.
-
equals
public boolean equals(Object other)
Determines equality of the object with the parameter.
-
_duplicate
public org.omg.CORBA.Object _duplicate()
- Specified by:
_duplicatein interfaceorg.omg.CORBA.Object
-
_release
public void _release()
- Specified by:
_releasein interfaceorg.omg.CORBA.Object
-
_is_a
public boolean _is_a(String repository_id)
- Specified by:
_is_ain interfaceorg.omg.CORBA.Object- Overrides:
_is_ain classorg.omg.PortableServer.Servant
-
_is_equivalent
public boolean _is_equivalent(org.omg.CORBA.Object that)
- Specified by:
_is_equivalentin interfaceorg.omg.CORBA.Object
-
_non_existent
public boolean _non_existent()
- Specified by:
_non_existentin interfaceorg.omg.CORBA.Object- Overrides:
_non_existentin classorg.omg.PortableServer.Servant
-
_hash
public int _hash(int maximum)
- Specified by:
_hashin interfaceorg.omg.CORBA.Object
-
_request
public org.omg.CORBA.Request _request(String operation)
- Specified by:
_requestin interfaceorg.omg.CORBA.Object
-
_create_request
public org.omg.CORBA.Request _create_request(org.omg.CORBA.Context ctx, String operation, org.omg.CORBA.NVList arg_list, org.omg.CORBA.NamedValue result)- Specified by:
_create_requestin interfaceorg.omg.CORBA.Object
-
_create_request
public org.omg.CORBA.Request _create_request(org.omg.CORBA.Context ctx, String operation, org.omg.CORBA.NVList arg_list, org.omg.CORBA.NamedValue result, org.omg.CORBA.ExceptionList exceptions, org.omg.CORBA.ContextList contexts)- Specified by:
_create_requestin interfaceorg.omg.CORBA.Object
-
_get_interface_def
public org.omg.CORBA.Object _get_interface_def()
- Specified by:
_get_interface_defin interfaceorg.omg.CORBA.Object- Overrides:
_get_interface_defin classorg.omg.PortableServer.Servant
-
_get_policy
public org.omg.CORBA.Policy _get_policy(int policy_type)
- Specified by:
_get_policyin interfaceorg.omg.CORBA.Object
-
_get_domain_managers
public org.omg.CORBA.DomainManager[] _get_domain_managers()
- Specified by:
_get_domain_managersin interfaceorg.omg.CORBA.Object
-
_set_policy_override
public org.omg.CORBA.Object _set_policy_override(org.omg.CORBA.Policy[] policies, org.omg.CORBA.SetOverrideType set_add)- Specified by:
_set_policy_overridein interfaceorg.omg.CORBA.Object
-
-