org.jbpm.env.session
Interface TimerSession

All Known Implementing Classes:
Ejb2TimerSession, StandardTimerSession

public interface TimerSession

Author:
Tom Baeyens, Pascal Verdage

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.
 

Method Detail

schedule

void schedule(Timer timer)
Schedule the execution of a timer.

Parameters:
timer - the timer to be executed.
Throws:
java.lang.IllegalArgumentException - if the timer is null or if its activity is null or if its dueDate is null or if its dueDate is negative or if its dueDate is past or if its dueDate is equals to Long.MAX_VALUE

cancel

void cancel(Timer timer)
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.

Parameters:
timer - the timer to be cancelled.

getScheduledActivities

java.util.Collection<ObjectReference<Activity>> getScheduledActivities()
Returns:
the scheduled activities, i.e. the activities that will be executed.

getNextScheduledActivityTime

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

getNextScheduledActivity

ObjectReference<Activity> getNextScheduledActivity()
Returns:
the next activity to be executed or null if none

getScheduledActivity

ObjectReference<Activity> getScheduledActivity(long id)
retrieve a task that still exists from its identifier.

Parameters:
id - the identifier of the task to retrieve
Returns:
the corresponding task or null if none exists.

findTimers

java.util.Collection<Timer> findTimers(Execution execution)
retrieve timers registered for a given execution

Parameters:
execution -
Returns:
the list of the timers registered for the given execution