org.jbpm.env.session
Class StandardTimerSession

java.lang.Object
  extended by org.jbpm.env.session.StandardTimerSession
All Implemented Interfaces:
TimerSession
Direct Known Subclasses:
Ejb2TimerSession

public class StandardTimerSession
extends java.lang.Object
implements TimerSession

Timers created with this service are committed at the end of the transaction, so their execution will be late if the delay is shorter than the transaction. In that case, they will be executed at the end of the transaction.

Author:
Pascal Verdage

Constructor Summary
StandardTimerSession()
           
 
Method Summary
 void cancel(Timer timer)
          Cancels a timer.
 java.util.Collection<Timer> findTimers(Execution execution)
          retrieve timers registered for a given execution
 ObjectReference<Activity> getNextScheduledActivity()
           
 long getNextScheduledActivityTime()
           
 java.util.Collection<ObjectReference<Activity>> getScheduledActivities()
           
 ObjectReference<Activity> getScheduledActivity(long id)
          retrieve a task that still exists from its identifier.
 void schedule(Timer timer)
          Schedule the execution of a timer.
 void start()
           
protected static void validScheduling(Timer timer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardTimerSession

public StandardTimerSession()
Method Detail

start

public void start()

validScheduling

protected static void validScheduling(Timer timer)

schedule

public void schedule(Timer timer)
Description copied from interface: TimerSession
Schedule the execution of a timer.

Specified by:
schedule in interface TimerSession
Parameters:
timer - the timer to be executed.

cancel

public void cancel(Timer timer)
Description copied from interface: TimerSession
Cancels a timer.
If a transaction is in progress, the cancellation will be effective at the end of the transaction. If the timer has been created in the same transaction or if there is no transaction, the cancellation is immediately effective.
If the timer is executing when the cancellation becomes effective, the execution in progress will not be stopped.

Specified by:
cancel in interface TimerSession
Parameters:
timer - the timer to be cancelled.

getNextScheduledActivity

public ObjectReference<Activity> getNextScheduledActivity()
Specified by:
getNextScheduledActivity in interface TimerSession
Returns:
the next activity to be executed or null if none

getNextScheduledActivityTime

public long getNextScheduledActivityTime()
Specified by:
getNextScheduledActivityTime in interface TimerSession
Returns:
the remaining time before the next execution of an activity or -1 if there is no scheduled activity.

getScheduledActivities

public java.util.Collection<ObjectReference<Activity>> getScheduledActivities()
Specified by:
getScheduledActivities in interface TimerSession
Returns:
the scheduled activities, i.e. the activities that will be executed.

getScheduledActivity

public ObjectReference<Activity> getScheduledActivity(long id)
Description copied from interface: TimerSession
retrieve a task that still exists from its identifier.

Specified by:
getScheduledActivity in interface TimerSession
Parameters:
id - the identifier of the task to retrieve
Returns:
the corresponding task or null if none exists.

findTimers

public java.util.Collection<Timer> findTimers(Execution execution)
Description copied from interface: TimerSession
retrieve timers registered for a given execution

Specified by:
findTimers in interface TimerSession
Returns:
the list of the timers registered for the given execution