org.objectweb.jass.hls.ont
Class ONT

java.lang.Object
  extended byorg.objectweb.jass.hls.ont.ONT
All Implemented Interfaces:
java.io.Serializable, javax.activity.opennested.UserOpenNested

public class ONT
extends java.lang.Object
implements javax.activity.opennested.UserOpenNested, java.io.Serializable

ONT service main class. It implements the UserOpenNested service interface offered to applications throught JNDI by the ONTService class. A singleton ONT object is created.

Author:
fran Date: Feb 11, 2004 org.objectweb.jass.hls.ontONT.java
See Also:
Serialized Form

Method Summary
 void activityBegin(int timeout)
          A new Activity is created.
 void activityCommit(javax.activity.opennested.Compensator compensator_object)
          The transactional Activity associated with the client thread is committed; this implicitly causes the commit of the associated transaction.
 int activityGetStatus()
          This operation returns the ActivityStatus of the activity associated with the calling thread.
 void activityRollback()
          The transactional Activity associated with the client thread is rolled back; this implicitly causes the rollback of the associated transaction.
 void activitySetRollbackOnly()
          The current Activity is modified so that the only possible outcome is rollback.
 void activitySetTimeout(int seconds)
          This method resets the default timeout value for ONT Activities.
 java.lang.String getActivityName()
          This operation returns a printable string describing the current activity.
 int getActivityTimeout()
          This operation returns the default timeout value that is used for activities that are begun with a timeout value of 0.
static ONT getSingleton()
          Returns the unique ONT service instance.
 java.lang.String getTransactionName()
          This operation returns a printable string describing the transaction associated with the current activity.
 void resume(javax.activity.opennested.ONTActivity activity)
          This is a TEST method!!! It allows to resume the last suspended activity.
 javax.activity.opennested.ONTActivity suspend()
          This is a TEST method!!! It allows to suspend the current activity.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSingleton

public static ONT getSingleton()
Returns the unique ONT service instance.

Returns:
The unique instance.

activityBegin

public void activityBegin(int timeout)
                   throws javax.activity.InvalidActivityException,
                          javax.activity.TimeoutRangeException
A new Activity is created. If the invoking thread already has an active Activity associated with it then the newly created Activity will be nested within it. Regardless of whether or not the Activity is nested, a top-level transaction is created using the Transaction Service and associated with the newly created Activity. The invoking thread's notion of the current Activity will be changed to this Activity.

Specified by:
activityBegin in interface javax.activity.opennested.UserOpenNested
Parameters:
timeout - - is used to control the lifetime of the transactional Activity. If the Activity has not completed by the time timeout seconds elapses, then it is subject to being rolled back. The timeout defined by the Open Nested Current interface is not controlled by the Open Nested Service which rather relies on the underlying Activity Service to manage it. Values the timeout can have are those defined by the Activity Service.
Throws:
javax.activity.InvalidActivityException
javax.activity.TimeoutRangeException

activityCommit

public void activityCommit(javax.activity.opennested.Compensator compensator_object)
                    throws javax.activity.NoActivityException,
                           javax.transaction.HeuristicMixedException,
                           javax.transaction.HeuristicRollbackException,
                           javax.activity.ActivityPendingException,
                           javax.activity.ContextPendingException,
                           javax.activity.NotOriginatorException,
                           javax.activity.opennested.ActivityRolledBackException,
                           javax.activity.opennested.HeuristicCompensateException,
                           javax.activity.opennested.HeuristicNoCompensateException
The transactional Activity associated with the client thread is committed; this implicitly causes the commit of the associated transaction. Only the Activity originator may call activity_commit().

Specified by:
activityCommit in interface javax.activity.opennested.UserOpenNested
Parameters:
compensator_object - - If the Activity/transaction can commit, this object will be registered as the compensating action for this activity/transaction. Failure to register the Compensator will cause the Activity to rollback.
Throws:
javax.activity.NoActivityException
javax.transaction.HeuristicMixedException
javax.transaction.HeuristicRollbackException
javax.activity.ActivityPendingException
javax.activity.ContextPendingException
javax.activity.NotOriginatorException
javax.activity.opennested.ActivityRolledBackException
javax.activity.opennested.HeuristicCompensateException
javax.activity.opennested.HeuristicNoCompensateException

activityRollback

public void activityRollback()
                      throws javax.activity.NoActivityException,
                             javax.activity.opennested.HeuristicNoCompensateException
The transactional Activity associated with the client thread is rolled back; this implicitly causes the rollback of the associated transaction. Any nested transactional activities are also rolled back.

Specified by:
activityRollback in interface javax.activity.opennested.UserOpenNested
Throws:
javax.activity.NoActivityException
javax.activity.opennested.HeuristicNoCompensateException

activitySetRollbackOnly

public void activitySetRollbackOnly()
                             throws javax.activity.NoActivityException
The current Activity is modified so that the only possible outcome is rollback. The associated transaction is also marked as rollback only.

Specified by:
activitySetRollbackOnly in interface javax.activity.opennested.UserOpenNested
Throws:
javax.activity.NoActivityException

activitySetTimeout

public void activitySetTimeout(int seconds)
                        throws javax.activity.TimeoutRangeException
This method resets the default timeout value for ONT Activities. The default timeout value is used for activities that are begun with a timeout value of 0.

Specified by:
activitySetTimeout in interface javax.activity.opennested.UserOpenNested
Throws:
javax.activity.TimeoutRangeException

getActivityTimeout

public int getActivityTimeout()
This operation returns the default timeout value that is used for activities that are begun with a timeout value of 0.

Specified by:
getActivityTimeout in interface javax.activity.opennested.UserOpenNested

activityGetStatus

public int activityGetStatus()
This operation returns the ActivityStatus of the activity associated with the calling thread. If there is no activity associated with the calling thread, the StatusNoActivity value is returned.

Specified by:
activityGetStatus in interface javax.activity.opennested.UserOpenNested

getActivityName

public java.lang.String getActivityName()
This operation returns a printable string describing the current activity. If there is no activity associated with the calling thread, an empty string is returned.

Specified by:
getActivityName in interface javax.activity.opennested.UserOpenNested

getTransactionName

public java.lang.String getTransactionName()
This operation returns a printable string describing the transaction associated with the current activity. If there is no current activity a null string is returned.

Specified by:
getTransactionName in interface javax.activity.opennested.UserOpenNested

suspend

public javax.activity.opennested.ONTActivity suspend()
This is a TEST method!!! It allows to suspend the current activity.

Specified by:
suspend in interface javax.activity.opennested.UserOpenNested
Returns:
the ONTActivity suspended.

resume

public void resume(javax.activity.opennested.ONTActivity activity)
This is a TEST method!!! It allows to resume the last suspended activity.

Specified by:
resume in interface javax.activity.opennested.UserOpenNested
Parameters:
activity - the ONTActivity to be resumed.