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

public class CurrentImple extends org.omg.CORBA.LocalObject implements Current, Current
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

    Fields
    Modifier and Type
    Field
    Description
    protected static ContextManager
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    commit(boolean report_heuristics)
    It's not possible to commit/abort out of order using the current interface.
    Returns the internal context manager implementation.
     
     
    final int
     
     
     
    com.arjuna.ats.internal.jts.ControlWrapper
     
    void
    resume(Control which)
    To support checked transactions we can only resume if the action is local or we received it implicitly.
    void
     
    void
    resumeWrapper(com.arjuna.ats.internal.jts.ControlWrapper which)
     
    void
    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
     
    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

  • Constructor Details

    • CurrentImple

      public CurrentImple()
  • Method Details

    • begin

      public void begin() throws SubtransactionsUnavailable, org.omg.CORBA.SystemException
      Specified by:
      begin in interface CurrentOperations
      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 interface CurrentOperations
      Throws:
      NoTransaction
      HeuristicMixed
      HeuristicHazard
      org.omg.CORBA.SystemException
    • rollback

      public void rollback() throws NoTransaction, org.omg.CORBA.SystemException
      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 interface CurrentOperations
      Throws:
      NoTransaction
      org.omg.CORBA.SystemException
    • rollback_only

      public void rollback_only() throws NoTransaction, org.omg.CORBA.SystemException
      If the transaction has already terminated (or is being terminated) then throw INVALID_TRANSACTION.
      Specified by:
      rollback_only in interface CurrentOperations
      Throws:
      NoTransaction
      org.omg.CORBA.SystemException
    • get_status

      public Status get_status() throws org.omg.CORBA.SystemException
      Specified by:
      get_status in interface CurrentOperations
      Throws:
      org.omg.CORBA.SystemException
    • get_transaction_name

      public String get_transaction_name() throws org.omg.CORBA.SystemException
      Specified by:
      get_transaction_name in interface CurrentOperations
      Throws:
      org.omg.CORBA.SystemException
    • set_timeout

      public void set_timeout(int seconds) throws org.omg.CORBA.SystemException
      Specified by:
      set_timeout in interface CurrentOperations
      Throws:
      org.omg.CORBA.SystemException
    • get_timeout

      public final int get_timeout() throws org.omg.CORBA.SystemException
      Throws:
      org.omg.CORBA.SystemException
    • setCheckedAction

      public void setCheckedAction(CheckedAction ca) throws org.omg.CORBA.SystemException
      Specified by:
      setCheckedAction in interface Current
      Throws:
      org.omg.CORBA.SystemException
    • getCheckedAction

      public CheckedAction getCheckedAction() throws org.omg.CORBA.SystemException
      Specified by:
      getCheckedAction in interface Current
      Throws:
      org.omg.CORBA.SystemException
    • get_control

      public Control get_control() throws org.omg.CORBA.SystemException
      Specified by:
      get_control in interface CurrentOperations
      Throws:
      org.omg.CORBA.SystemException
    • suspend

      public Control suspend() throws org.omg.CORBA.SystemException
      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 interface CurrentOperations
      Throws:
      org.omg.CORBA.SystemException
    • resume

      public void resume(Control which) throws InvalidControl, org.omg.CORBA.SystemException
      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 interface CurrentOperations
      Throws:
      InvalidControl
      org.omg.CORBA.SystemException
    • contextManager

      public final ContextManager contextManager()
      Returns the internal context manager implementation. Applications should not use this method.
      Since:
      JTS 2.1.
    • resumeImple

      public void resumeImple(ControlImple which) throws InvalidControl, org.omg.CORBA.SystemException
      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