Class CurrentImpl
- java.lang.Object
-
- org.omg.CORBA.LocalObject
-
- com.sun.jts.CosTransactions.CurrentImpl
-
- All Implemented Interfaces:
Serializable
,org.omg.CORBA.Current
,org.omg.CORBA.CurrentOperations
,org.omg.CORBA.Object
,org.omg.CORBA.portable.IDLEntity
,org.omg.CosTransactions.Current
,org.omg.CosTransactions.CurrentOperations
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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()
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()
Rolls back the changes performed under the current transaction.void
rollback_only()
Marks the current transaction such that is cannot be committed and only rolled back.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, _get_interface_def, _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
-
-
-
-
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.
- Specified by:
begin
in interfaceorg.omg.CosTransactions.CurrentOperations
- 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.
-
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.
- 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.
-
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.
- Specified by:
commit
in interfaceorg.omg.CosTransactions.CurrentOperations
- 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.
-
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.
- Specified by:
rollback
in interfaceorg.omg.CosTransactions.CurrentOperations
- 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.
-
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.- Specified by:
rollback_only
in interfaceorg.omg.CosTransactions.CurrentOperations
- Throws:
org.omg.CosTransactions.NoTransaction
- There is no current transaction to mark rollback- only.
-
get_status
public org.omg.CosTransactions.Status get_status()
Returns the status of the current transaction.- Specified by:
get_status
in interfaceorg.omg.CosTransactions.CurrentOperations
- Returns:
- The current status of the transaction. If there is no current transaction, the value StatusNoTransaction is returned.
-
get_transaction_name
public String get_transaction_name()
Returns a printable string representing the current transaction.- Specified by:
get_transaction_name
in interfaceorg.omg.CosTransactions.CurrentOperations
- Returns:
- The transaction name. If there is no current transaction, null is returned.
-
set_timeout
public void set_timeout(int timeout)
Sets the timeout value to be used for all subsequent transactions.- Specified by:
set_timeout
in interfaceorg.omg.CosTransactions.CurrentOperations
- Parameters:
timeout
- The timeout value in seconds.
-
get_timeout
public int get_timeout()
- Specified by:
get_timeout
in interfaceorg.omg.CosTransactions.CurrentOperations
-
get_control
public org.omg.CosTransactions.Control get_control() throws org.omg.CORBA.TRANSACTION_ROLLEDBACK
Returns the current ControlImpl object.- Specified by:
get_control
in interfaceorg.omg.CosTransactions.CurrentOperations
- 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.
-
suspend
public org.omg.CosTransactions.Control suspend()
Disassociates the current ControlImpl from the calling thread.- Specified by:
suspend
in interfaceorg.omg.CosTransactions.CurrentOperations
- Returns:
- The Control object for the suspended transaction. If there was no transaction, this will be null.
-
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.
- Specified by:
resume
in interfaceorg.omg.CosTransactions.CurrentOperations
- 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.
-
_ids
public String[] _ids()
-
-