Package org.jppf.scheduling
Class JPPFSchedule
java.lang.Object
org.jppf.scheduling.JPPFSchedule
- All Implemented Interfaces:
Serializable
Instances of this class contain data used to setup a schedule.
This includes duration, date, date format.
- Author:
- Laurent Cohen
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionJPPFSchedule(long duration) Initialize this schedule configuration with the specified duration.JPPFSchedule(String date, String format) Initialize this schedule configuration with the specified fixed date annd date format.JPPFSchedule(Duration duration) Initialize this schedule configuration with the specified duration.JPPFSchedule(ZonedDateTime zonedDateTime) Initialize this schedule configuration with the specified date. -
Method Summary
Modifier and TypeMethodDescriptiongetDate()Get the scheduled date for this configuration.longGet the duration for this configuration.Get the schedule duration expressed as aDurationinstance.Get the format of timeout date for this task.Get the schedule date expressed as aZonedDateTimeinstance.booleanhasDate()Determine whether this schedule was initialized with aDate.booleanDetermine whether this schedule was initialized with a duration.booleanDetermine whether this schedule was initialized with aDuration.booleanDetermine whether this schedule was initialized with aZonedDateTime.toDate(long startDate) Deprecated.longtoLong(long startDate) Convert this schedule to a long value.toString()
-
Constructor Details
-
JPPFSchedule
public JPPFSchedule(long duration) Initialize this schedule configuration with the specified duration.- Parameters:
duration- the duration in milliseconds. If the value is zero or less, then this schedule will expire immediately.
-
JPPFSchedule
Initialize this schedule configuration with the specified fixed date annd date format.- Parameters:
date- the schedule date provided as a string. If the date is equal to or before the creation time of this schedule, then this schedule will expire immediately.format- the format in which the date is expressed (including locale and time zone information), as specified in the description ofSimpleDateFormat.
-
JPPFSchedule
Initialize this schedule configuration with the specified date.- Parameters:
zonedDateTime- the schedule date. If the date is equal to or before the creation time of this schedule, then this schedule will expire immediately.
-
JPPFSchedule
Initialize this schedule configuration with the specified duration.- Parameters:
duration- the duration before this schedule expires or times out. If duaration resolves to a value of zero or less, then this schedule will expire immediately.
-
-
Method Details
-
getDuration
public long getDuration()Get the duration for this configuration. The time at which the duration starts dependants on who is using it. For instance, for scheduling a job, it starts when the job is inserted into the job queue by the server.- Returns:
- the timeout in milliseconds.
-
getDate
Get the scheduled date for this configuration.- Returns:
- the date in string format.
-
getFormat
Get the format of timeout date for this task.- Returns:
- the date format as a string pattern.
-
getZonedDateTime
Get the schedule date expressed as aZonedDateTimeinstance.- Returns:
- a
ZonedDateTimeif this schedule was constructed with aZonedDateTime, otherwisenull.
-
getDurationObject
Get the schedule duration expressed as aDurationinstance. -
toDate
Deprecated.usetoLong(long startDate)instead.Convert this schedule to aDateobject.- Parameters:
startDate- the starting date to use if the schedule is expressed as a duration.- Returns:
- this schedule expressed as a
Date. - Throws:
ParseException- if parsing using the simple date format fails.
-
toLong
Convert this schedule to a long value.- Parameters:
startDate- the starting date to use if the schedule is expressed as a duration.- Returns:
- this schedule expressed as a long.
- Throws:
ParseException- if parsing using the simple date format fails.
-
toString
-
hasDate
public boolean hasDate()Determine whether this schedule was initialized with aDate.- Returns:
trueif aDatewas specified when constructing this schedule,falseotherwise.
-
hasDuration
public boolean hasDuration()Determine whether this schedule was initialized with a duration.- Returns:
trueif alongduration was specified when constructing this schedule,falseotherwise.
-
hasZonedDateTime
public boolean hasZonedDateTime()Determine whether this schedule was initialized with aZonedDateTime.- Returns:
trueif aZonedDateTimewas specified when constructing this schedule,falseotherwise.
-
hasDurationObject
public boolean hasDurationObject()Determine whether this schedule was initialized with aDuration.- Returns:
trueif aDurationwas specified when constructing this schedule,falseotherwise.
-
toLong(long startDate)instead.