public class

ScheduleConfig

extends Object
java.lang.Object
   ↳ org.apache.helix.task.ScheduleConfig

Class Overview

Configuration for scheduling both one-time and recurring workflows in Helix

Summary

Public Methods
static ScheduleConfig from(ScheduleBean bean)
Create this configuration from a serialized bean
Long getRecurrenceInterval()
The magnitude of the recurrence interval if this is a recurring task
TimeUnit getRecurrenceUnit()
The unit of the recurrence interval if this is a recurring workflow
Date getStartTime()
When the workflow should be started
boolean isRecurring()
Check if this workflow is recurring
boolean isValid()
Check if the configured schedule is valid given these constraints:
  • All workflows must have a start time
  • Recurrence unit and interval must both be present if either is present
  • Recurring workflows must have a positive interval magnitude
  • Intervals must be at least one minute
static ScheduleConfig oneTimeDelayedStart(Date startTime)
Create a schedule for a workflow that runs once at a specified time
static ScheduleConfig recurringFromDate(Date startTime, TimeUnit recurUnit, long recurInterval)
Create a schedule for a recurring workflow that should start at a specific time
static ScheduleConfig recurringFromNow(TimeUnit recurUnit, long recurInterval)
Create a schedule for a recurring workflow that should start immediately
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static ScheduleConfig from (ScheduleBean bean)

Create this configuration from a serialized bean

Parameters
bean flat configuration of the schedule
Returns
  • instantiated ScheduleConfig

public Long getRecurrenceInterval ()

The magnitude of the recurrence interval if this is a recurring task

Returns
  • the recurrence interval magnitude, or null if this workflow is a one-time workflow

public TimeUnit getRecurrenceUnit ()

The unit of the recurrence interval if this is a recurring workflow

Returns
  • the recurrence interval unit, or null if this workflow is a one-time workflow

public Date getStartTime ()

When the workflow should be started

Returns
  • Date object representing the start time

public boolean isRecurring ()

Check if this workflow is recurring

Returns
  • true if recurring, false if one-time

public boolean isValid ()

Check if the configured schedule is valid given these constraints:

  • All workflows must have a start time
  • Recurrence unit and interval must both be present if either is present
  • Recurring workflows must have a positive interval magnitude
  • Intervals must be at least one minute

Returns
  • true if valid, false if invalid

public static ScheduleConfig oneTimeDelayedStart (Date startTime)

Create a schedule for a workflow that runs once at a specified time

Parameters
startTime the time to start the workflow
Returns
  • instantiated ScheduleConfig

public static ScheduleConfig recurringFromDate (Date startTime, TimeUnit recurUnit, long recurInterval)

Create a schedule for a recurring workflow that should start at a specific time

Parameters
startTime the time to start the workflow the first time, or null if now
recurUnit the unit of the recurrence interval
recurInterval the magnitude of the recurrence interval
Returns
  • instantiated ScheduleConfig

public static ScheduleConfig recurringFromNow (TimeUnit recurUnit, long recurInterval)

Create a schedule for a recurring workflow that should start immediately

Parameters
recurUnit the unit of the recurrence interval
recurInterval the magnitude of the recurrence interval
Returns
  • instantiated ScheduleConfig