Class CurrentImple
java.lang.Object
org.omg.CORBA.LocalObject
com.arjuna.ats.internal.jts.orbspecific.CurrentImple
- All Implemented Interfaces:
Current
,Serializable
,org.omg.CORBA.Current
,org.omg.CORBA.CurrentOperations
,org.omg.CORBA.Object
,org.omg.CORBA.portable.IDLEntity
,Current
,CurrentOperations
The implementation of CosTransactions::Current.
In a multi-threaded environment where threads can terminate transactions they
may not have started, then it is possible for a thread to call
commit/rollback/rollback_only on a transaction which has already been (or is
in the process of being) terminated. We assume that the subsequent thread is
still associated with the transaction so that it can determine its status,
rather than simply disassociate it when it tries to terminate and return
NoTransaction, so we would return INVALID_TRANSACTION. This allows us to
distinguish between the situation where there really is no transaction
associated with the thread.
- Since:
- JTS 1.0.
- Version:
- $Id: CurrentImple.java 2342 2006-03-30 13:06:17Z $
- Author:
- Mark Little (mark@arjuna.com)
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected static ContextManager
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
begin()
void
commit
(boolean report_heuristics) It's not possible to commit/abort out of order using the current interface.final ContextManager
Returns the internal context manager implementation.final int
com.arjuna.ats.internal.jts.ControlWrapper
void
To support checked transactions we can only resume if the action is local or we received it implicitly.void
resumeImple
(ControlImple which) void
resumeWrapper
(com.arjuna.ats.internal.jts.ControlWrapper which) void
rollback()
If another thread has already terminated the transaction then: (i) if it rolled back, we do nothing - could throw TransactionRequired of INVALID_TRANSACTION, or NoTransaction.void
If the transaction has already terminated (or is being terminated) then throw INVALID_TRANSACTION.void
set_timeout
(int seconds) void
suspend()
The spec.com.arjuna.ats.internal.jts.ControlWrapper
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
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
-
Field Details
-
TX_BEGUN
public static final int TX_BEGUN- See Also:
-
TX_COMMITTED
public static final int TX_COMMITTED- See Also:
-
TX_ABORTED
public static final int TX_ABORTED- See Also:
-
TX_SUSPENDED
public static final int TX_SUSPENDED- See Also:
-
TX_RESUMED
public static final int TX_RESUMED- See Also:
-
_theManager
-
-
Constructor Details
-
CurrentImple
public CurrentImple()
-
-
Method Details
-
begin
- Specified by:
begin
in interfaceCurrentOperations
- Throws:
SubtransactionsUnavailable
org.omg.CORBA.SystemException
-
commit
public void commit(boolean report_heuristics) throws NoTransaction, HeuristicMixed, HeuristicHazard, org.omg.CORBA.SystemException It's not possible to commit/abort out of order using the current interface. Do we delete the control if the transaction gives an heuristic result? CurrentImplely we do. If another thread has already terminated the transaction then: (i) if it committed, we do nothing - could throw TransactionRequired of INVALID_TRANSACTION, or NoTransaction. Probably not NoTransaction, since it would be better to distinguish between the situation where the transaction has already been terminated and there really is no transaction for this thread. (ii) if it rolledback, we throw TRANSACTION_ROLLEDBACK.- Specified by:
commit
in interfaceCurrentOperations
- Throws:
NoTransaction
HeuristicMixed
HeuristicHazard
org.omg.CORBA.SystemException
-
rollback
If another thread has already terminated the transaction then: (i) if it rolled back, we do nothing - could throw TransactionRequired of INVALID_TRANSACTION, or NoTransaction. Probably not NoTransaction, since it would be better to distinguish between the situation where the transaction has already been terminated and there really is no transaction for this thread. (ii) if it committed, we throw INVALID_TRANSACTION.- Specified by:
rollback
in interfaceCurrentOperations
- Throws:
NoTransaction
org.omg.CORBA.SystemException
-
rollback_only
If the transaction has already terminated (or is being terminated) then throw INVALID_TRANSACTION.- Specified by:
rollback_only
in interfaceCurrentOperations
- Throws:
NoTransaction
org.omg.CORBA.SystemException
-
get_status
- Specified by:
get_status
in interfaceCurrentOperations
- Throws:
org.omg.CORBA.SystemException
-
get_transaction_name
- Specified by:
get_transaction_name
in interfaceCurrentOperations
- Throws:
org.omg.CORBA.SystemException
-
set_timeout
public void set_timeout(int seconds) throws org.omg.CORBA.SystemException - Specified by:
set_timeout
in interfaceCurrentOperations
- Throws:
org.omg.CORBA.SystemException
-
get_timeout
public final int get_timeout() throws org.omg.CORBA.SystemException- Throws:
org.omg.CORBA.SystemException
-
setCheckedAction
- Specified by:
setCheckedAction
in interfaceCurrent
- Throws:
org.omg.CORBA.SystemException
-
getCheckedAction
- Specified by:
getCheckedAction
in interfaceCurrent
- Throws:
org.omg.CORBA.SystemException
-
get_control
- Specified by:
get_control
in interfaceCurrentOperations
- Throws:
org.omg.CORBA.SystemException
-
suspend
The spec. states that after suspend we should have a null transaction context, but is hazy as to what to do if we are nested. We shall assume that the control returned is for the current transaction and that we suspend the entire transaction hierarchy. Given the returned control, we can always regenerate the hierarchy later if required by resume.- Specified by:
suspend
in interfaceCurrentOperations
- Throws:
org.omg.CORBA.SystemException
-
resume
To support checked transactions we can only resume if the action is local or we received it implicitly. If the control refers to a nested transaction then we must recreate the entire hierarchy, i.e., the effect of a suspend/resume on the same control should be the same as never calling suspend in the first place. If the control is for a local transaction then it is simple to recreate the hierarchy. Otherwise we rely upon the PropagationContext to recreate it. If this control is a "proxy" then create a new proxy instance, so we can delete proxies whenever suspend is called. Should check if "new" transaction is not actually the current one anyway. If so, just return. The spec. doesn't mention what to do in this case, so for now we go to the overhead of the work regardless.- Specified by:
resume
in interfaceCurrentOperations
- Throws:
InvalidControl
org.omg.CORBA.SystemException
-
contextManager
Returns the internal context manager implementation. Applications should not use this method.- Since:
- JTS 2.1.
-
resumeImple
- Throws:
InvalidControl
org.omg.CORBA.SystemException
-
resumeWrapper
public void resumeWrapper(com.arjuna.ats.internal.jts.ControlWrapper which) throws InvalidControl, org.omg.CORBA.SystemException - Throws:
InvalidControl
org.omg.CORBA.SystemException
-
suspendWrapper
public com.arjuna.ats.internal.jts.ControlWrapper suspendWrapper() throws org.omg.CORBA.SystemException- Throws:
org.omg.CORBA.SystemException
-
getControlWrapper
public com.arjuna.ats.internal.jts.ControlWrapper getControlWrapper() throws org.omg.CORBA.SystemException- Throws:
org.omg.CORBA.SystemException
-