org.qi4j.library.scheduler
Class SchedulerMixin

java.lang.Object
  extended by org.qi4j.library.scheduler.SchedulerMixin
All Implemented Interfaces:
Scheduler, SchedulerActivation

public class SchedulerMixin
extends java.lang.Object
implements Scheduler, SchedulerActivation


Nested Class Summary
static class SchedulerMixin.ScheduleRunner
          Handle Task's UnitOfWork and TimelineRecords creation.
 
Nested classes/interfaces inherited from interface org.qi4j.library.scheduler.SchedulerActivation
SchedulerActivation.Activator
 
Constructor Summary
SchedulerMixin()
           
 
Method Summary
 void activateScheduler()
           
static java.lang.String getSchedulesIdentity(SchedulerService service)
           
 void passivateScheduler()
           
 Schedule scheduleCron(Task task, java.lang.String cronExpression, boolean durable)
          Schedule a Task using a CronExpression.
 Schedule scheduleCron(Task task, java.lang.String cronExpression, org.joda.time.DateTime start, boolean durable)
          Schedule a Task using a CronExpression starting at a given date.
 Schedule scheduleCron(Task task, java.lang.String cronExpression, long initialDelay, boolean durable)
          Schedule a Task using a CronExpression with a given initial delay in milliseconds.
 Schedule scheduleOnce(Task task, org.joda.time.DateTime runAt, boolean durable)
          Schedule a Task to be run after a given initial delay in seconds.
 Schedule scheduleOnce(Task task, int initialSecondsDelay, boolean durable)
          Schedule a Task to be run after a given initial delay in seconds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchedulerMixin

public SchedulerMixin()
Method Detail

scheduleOnce

public Schedule scheduleOnce(Task task,
                             int initialSecondsDelay,
                             boolean durable)
Description copied from interface: Scheduler
Schedule a Task to be run after a given initial delay in seconds.

Specified by:
scheduleOnce in interface Scheduler
Parameters:
task - Task to be scheduled once
initialSecondsDelay - Initial delay the Task will be run after, in seconds
durable - true if this Schedule should survive a restart.
Returns:
The newly created Schedule

scheduleOnce

public Schedule scheduleOnce(Task task,
                             org.joda.time.DateTime runAt,
                             boolean durable)
Description copied from interface: Scheduler
Schedule a Task to be run after a given initial delay in seconds.

Specified by:
scheduleOnce in interface Scheduler
Parameters:
task - Task to be scheduled once
runAt - The future point in time when the Schedule will be run.
durable - true if this Schedule should survive a restart.
Returns:
The newly created Schedule

scheduleCron

public Schedule scheduleCron(Task task,
                             java.lang.String cronExpression,
                             boolean durable)
Description copied from interface: Scheduler
Schedule a Task using a CronExpression.

Specified by:
scheduleCron in interface Scheduler
Parameters:
task - Task to be scheduled once
cronExpression - CronExpression for creating the Schedule for the given Task
durable - true if this Schedule should survive a restart.
Returns:
The newly created Schedule

scheduleCron

public Schedule scheduleCron(Task task,
                             java.lang.String cronExpression,
                             org.joda.time.DateTime start,
                             boolean durable)
Description copied from interface: Scheduler
Schedule a Task using a CronExpression starting at a given date.

Specified by:
scheduleCron in interface Scheduler
Parameters:
task - Task to be scheduled once
cronExpression - CronExpression for creating the Schedule for the given Task
start - Date from which the Schedule will become active
durable - true if this Schedule should survive a restart.
Returns:
The newly created Schedule

scheduleCron

public Schedule scheduleCron(Task task,
                             java.lang.String cronExpression,
                             long initialDelay,
                             boolean durable)
Description copied from interface: Scheduler
Schedule a Task using a CronExpression with a given initial delay in milliseconds.

Specified by:
scheduleCron in interface Scheduler
Parameters:
task - Task to be scheduled once
cronExpression - CronExpression for creating the Schedule for the given Task
initialDelay - Initial delay the Schedule will be active after, in milliseconds
durable - true if this Schedule should survive a restart.
Returns:
The newly created Schedule

activateScheduler

public void activateScheduler()
                       throws java.lang.Exception
Specified by:
activateScheduler in interface SchedulerActivation
Throws:
java.lang.Exception

getSchedulesIdentity

public static java.lang.String getSchedulesIdentity(SchedulerService service)

passivateScheduler

public void passivateScheduler()
                        throws java.lang.Exception
Specified by:
passivateScheduler in interface SchedulerActivation
Throws:
java.lang.Exception