com.sun.jts.CosTransactions
Class CurrentImpl

java.lang.Object
  extended by org.omg.CORBA.LocalObject
      extended by com.sun.jts.CosTransactions.CurrentImpl
All Implemented Interfaces:
java.io.Serializable, org.omg.CORBA.Current, org.omg.CORBA.CurrentOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity

public class CurrentImpl
extends org.omg.CORBA.LocalObject
implements org.omg.CosTransactions.Current

The CurrentImpl class is our implementation of the standard Current interface. It provides operations that enable the demarcation of a transaction's scope. These operations are specified in pseudo-IDL. The CurrentImpl ensures that the CurrentTransaction class is set up when the CurrentImpl is created. As an instance of this class may be accessed from multiple threads within a process, serialisation for thread-safety is necessary in the implementation.

Version:
0.01
Author:
Simon Holdsworth, IBM Corporation
See Also:
, Serialized Form

Method Summary
 java.lang.String[] _ids()
           
 void begin()
          Creates a new Control object, containing new Terminator and Coordinator objects.
 void begin(int time_out)
          Creates a new Control object, containing new Terminator and Coordinator objects.
 void commit(boolean reportHeuristics)
          Completes the current transaction.
 org.omg.CosTransactions.Control get_control()
          Returns the current ControlImpl object.
 org.omg.CosTransactions.Status get_status()
          Returns the status of the current transaction.
 int get_timeout()
           
 java.lang.String get_transaction_name()
          Returns a printable string representing the current transaction.
 void resume(org.omg.CosTransactions.Control control)
          Re-associates the given Control to the calling thread.
 void rollback_only()
          Marks the current transaction such that is cannot be committed and only rolled back.
 void rollback()
          Rolls back the changes performed under the current transaction.
 void set_timeout(int timeout)
          Sets the timeout value to be used for all subsequent transactions.
 org.omg.CosTransactions.Control suspend()
          Disassociates the current ControlImpl from the calling thread.
 
Methods inherited from class org.omg.CORBA.LocalObject
_create_request, _create_request, _duplicate, _get_domain_managers, _get_interface_def, _get_interface, _get_policy, _hash, _invoke, _is_a, _is_equivalent, _is_local, _non_existent, _orb, _release, _releaseReply, _request, _request, _servant_postinvoke, _servant_preinvoke, _set_policy_override, validate_connection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.omg.CORBA.Object
_create_request, _create_request, _duplicate, _get_domain_managers, _get_interface_def, _get_policy, _hash, _is_a, _is_equivalent, _non_existent, _release, _request, _set_policy_override
 

Method Detail

begin

public void begin()
           throws org.omg.CORBA.INVALID_TRANSACTION,
                  org.omg.CORBA.SystemException,
                  org.omg.CosTransactions.SubtransactionsUnavailable
Creates a new Control object, containing new Terminator and Coordinator objects.

The current timeout value is passed to the Coordinator.

The Control object is made the current one for the thread on which this method was invoked. If there is already a current Control the existing Control that represents the parent transaction is stacked behind the new one, which becomes the current one.

Parameters:
-
Throws:
org.omg.CosTransactions.SubtransactionsUnavailable - A subtransaction cannot be begun, either because the Transaction Service does not support nested transactions or because the current transaction is completing.
org.omg.CORBA.INVALID_TRANSACTION - The transaction could not be begun as the current thread of control has pending non-transactional work.
org.omg.CORBA.SystemException - The operation failed.
See Also:

begin

public void begin(int time_out)
           throws org.omg.CORBA.INVALID_TRANSACTION,
                  org.omg.CORBA.SystemException,
                  org.omg.CosTransactions.SubtransactionsUnavailable
Creates a new Control object, containing new Terminator and Coordinator objects.

Input parameter timeout value is passed to the Coordinator.

The Control object is made the current one for the thread on which this method was invoked. If there is already a current Control the existing Control that represents the parent transaction is stacked behind the new one, which becomes the current one.

Parameters:
-
Throws:
org.omg.CosTransactions.SubtransactionsUnavailable - A subtransaction cannot be begun, either because the Transaction Service does not support nested transactions or because the current transaction is completing.
org.omg.CORBA.INVALID_TRANSACTION - The transaction could not be begun as the current thread of control has pending non-transactional work.
org.omg.CORBA.SystemException - The operation failed.
See Also:

commit

public void commit(boolean reportHeuristics)
            throws org.omg.CORBA.NO_PERMISSION,
                   org.omg.CORBA.INVALID_TRANSACTION,
                   org.omg.CORBA.TRANSACTION_ROLLEDBACK,
                   org.omg.CosTransactions.NoTransaction,
                   org.omg.CosTransactions.HeuristicHazard,
                   org.omg.CosTransactions.HeuristicMixed,
                   org.omg.CORBA.SystemException
Completes the current transaction.

This operation can only be called if there is a Terminator object available.

Parameters:
reportHeuristics - Indicates that heuristic exceptions should be passed back to the caller.
Throws:
org.omg.CosTransactions.NoTransaction - There is no current transaction to commit.
org.omg.CORBA.INVALID_TRANSACTION - The current transaction has outstanding work and the Transaction Service is "checked".
org.omg.CORBA.NO_PERMISSION - The caller is not allowed to commit the transaction.
org.omg.CORBA.TRANSACTION_ROLLEDBACK - The transaction could not be committed, and has been rolled back.
org.omg.CosTransactions.HeuristicHazard - Heuristic action may have been taken by a participant in the transaction.
org.omg.CosTransactions.HeuristicMixed - Heuristic action has been taken by a participant in the transaction.
org.omg.CORBA.SystemException - The operation failed.
See Also:

rollback

public void rollback()
              throws org.omg.CosTransactions.NoTransaction,
                     org.omg.CORBA.INVALID_TRANSACTION,
                     org.omg.CORBA.NO_PERMISSION,
                     org.omg.CORBA.TRANSACTION_ROLLEDBACK,
                     org.omg.CORBA.SystemException
Rolls back the changes performed under the current transaction.

This operation can only be called if there is a Terminator object available.

Parameters:
-
Throws:
org.omg.CosTransactions.NoTransaction - There is no current transaction to rollback.
org.omg.CORBA.INVALID_TRANSACTION - The current transaction has outstanding work and the Transaction Service is "checked".
org.omg.CORBA.NO_PERMISSION - The caller is not allowed to roll the transaction back.
org.omg.CORBA.TRANSACTION_ROLLEDBACK - The transaction has already been rolled back.
org.omg.CORBA.SystemException - The operation failed.
See Also:

rollback_only

public void rollback_only()
                   throws org.omg.CosTransactions.NoTransaction
Marks the current transaction such that is cannot be committed and only rolled back.

Parameters:
-
Throws:
org.omg.CosTransactions.NoTransaction - There is no current transaction to mark rollback- only.
See Also:

get_status

public org.omg.CosTransactions.Status get_status()
Returns the status of the current transaction.

Parameters:
-
Returns:
The current status of the transaction. If there is no current transaction, the value StatusNoTransaction is returned.
See Also:

get_transaction_name

public java.lang.String get_transaction_name()
Returns a printable string representing the current transaction.

Parameters:
-
Returns:
The transaction name. If there is no current transaction, null is returned.
See Also:

set_timeout

public void set_timeout(int timeout)
Sets the timeout value to be used for all subsequent transactions.

Parameters:
timeout - The timeout value in seconds.
See Also:

get_timeout

public int get_timeout()

get_control

public org.omg.CosTransactions.Control get_control()
                                            throws org.omg.CORBA.TRANSACTION_ROLLEDBACK
Returns the current ControlImpl object.

Parameters:
-
Returns:
The Control object for the current transaction, or null if there is no current transaction.
Throws:
org.omg.CORBA.TRANSACTION_ROLLEDBACK - The current transaction has been rolled back.
See Also:

suspend

public org.omg.CosTransactions.Control suspend()
Disassociates the current ControlImpl from the calling thread.

Parameters:
-
Returns:
The Control object for the suspended transaction. If there was no transaction, this will be null.
See Also:

resume

public void resume(org.omg.CosTransactions.Control control)
            throws org.omg.CosTransactions.InvalidControl,
                   org.omg.CORBA.INVALID_TRANSACTION
Re-associates the given Control to the calling thread.

If there is already a current ControlImpl, it is replaced as the current one.

Parameters:
control - The Control object to be made current.
Throws:
org.omg.CosTransactions.InvalidControl - The Control object passed as a parameter is not valid. This may be because the transaction it represents has already completed, or because the object is of the wrong type.
org.omg.CORBA.INVALID_TRANSACTION - The transaction could not be begun as the current thread of control has pending non-transactional work.
See Also:

_ids

public java.lang.String[] _ids()


Copyright © 2012 GlassFish Community. All Rights Reserved.