2016/02/07 - Apache Onami has been retired.

For more information, please explore the Attic.

public final class

JobSchedulerBuilder

extends Object
java.lang.Object
   ↳ org.apache.onami.scheduler.JobSchedulerBuilder

Class Overview

DSL to produce Job and add to a Scheduler, and associate the related Trigger with it.

Summary

Public Methods
void schedule(Scheduler scheduler)
Add the produced Job to the given Scheduler, and associate the related Trigger with it.
JobSchedulerBuilder updateExistingTrigger()
Requests an existing trigger (sharing the same key as the new trigger) for this job to be replaced with the new trigger.
JobSchedulerBuilder withCronExpression(String cronExpression)
Sets the cron expression to base the schedule on.
JobSchedulerBuilder withJobGroup(String jobGroup)
Sets the Job group.
JobSchedulerBuilder withJobName(String jobName)
Sets the Job name, must be unique within the group.
JobSchedulerBuilder withPriority(int priority)
Sets the Trigger's priority.
JobSchedulerBuilder withRequestRecovery(boolean requestRecovery)
Instructs the Scheduler whether or not the Job should be re-executed if a recovery or fail-over situation is encountered.
JobSchedulerBuilder withStoreDurably(boolean storeDurably)
Whether or not the Job should remain stored after it is orphaned (no Triggers point to it).
JobSchedulerBuilder withTimeZone(TimeZone timeZone)
Sets the time zone for which the cronExpression of this CronTrigger will be resolved.
JobSchedulerBuilder withTrigger(Trigger trigger)
Sets the Trigger that will be used to schedule the Job.
JobSchedulerBuilder withTriggerGroup(String triggerGroup)
Sets the Trigger group.
JobSchedulerBuilder withTriggerName(String triggerName)
Sets the Trigger name, must be unique within the group.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public void schedule (Scheduler scheduler)

Add the produced Job to the given Scheduler, and associate the related Trigger with it. Users MUST NOT use this method!

Parameters
scheduler The given Scheduler
Throws
Exception If any error occurs

public JobSchedulerBuilder updateExistingTrigger ()

Requests an existing trigger (sharing the same key as the new trigger) for this job to be replaced with the new trigger.

Returns
  • This builder instance

public JobSchedulerBuilder withCronExpression (String cronExpression)

Sets the cron expression to base the schedule on.

Parameters
cronExpression The cron expression to base the schedule on
Returns
  • This builder instance

public JobSchedulerBuilder withJobGroup (String jobGroup)

Sets the Job group.

Parameters
jobGroup The Job group
Returns
  • This builder instance

public JobSchedulerBuilder withJobName (String jobName)

Sets the Job name, must be unique within the group.

Parameters
jobName The Job name, must be unique within the group
Returns
  • This builder instance

public JobSchedulerBuilder withPriority (int priority)

Sets the Trigger's priority. When more than one Trigger have the same fire time, the scheduler will fire the one with the highest priority first.

Parameters
priority The Trigger's priority
Returns
  • This builder instance

public JobSchedulerBuilder withRequestRecovery (boolean requestRecovery)

Instructs the Scheduler whether or not the Job should be re-executed if a recovery or fail-over situation is encountered.

Parameters
requestRecovery The activation flag
Returns
  • This builder instance

public JobSchedulerBuilder withStoreDurably (boolean storeDurably)

Whether or not the Job should remain stored after it is orphaned (no Triggers point to it).

Parameters
storeDurably The activation flag
Returns
  • This builder instance

public JobSchedulerBuilder withTimeZone (TimeZone timeZone)

Sets the time zone for which the cronExpression of this CronTrigger will be resolved.

Parameters
timeZone The time zone for which the cronExpression of this CronTrigger will be resolved.
Returns
  • This builder instance

public JobSchedulerBuilder withTrigger (Trigger trigger)

Sets the Trigger that will be used to schedule the Job.

Be aware that using using this method will override any other Trigger-related operation, like withTriggerGroup(String) or withTimeZone(TimeZone)

Parameters
trigger The Trigger to associate with the Job
Returns
  • This builder instance

public JobSchedulerBuilder withTriggerGroup (String triggerGroup)

Sets the Trigger group.

Parameters
triggerGroup The Trigger group
Returns
  • This builder instance

public JobSchedulerBuilder withTriggerName (String triggerName)

Sets the Trigger name, must be unique within the group.

Parameters
triggerName The Trigger name, must be unique within the group
Returns
  • This builder instance