org.jppf.scheduling
Class JPPFSchedule

java.lang.Object
  extended by org.jppf.scheduling.JPPFSchedule
All Implemented Interfaces:
Serializable

public class JPPFSchedule
extends Object
implements Serializable

Instances of this class contain data used to setup a schedule. This includes duration, date, date format.

Author:
Laurent Cohen
See Also:
Serialized Form

Constructor Summary
JPPFSchedule(long duration)
          Initialize this schedule configuration with the specified duration.
JPPFSchedule(String date, SimpleDateFormat dateFormat)
          Deprecated. use JPPFSchedule(String, String) instead.
JPPFSchedule(String date, String format)
          Initialize this schedule configuration with the specified duration.
 
Method Summary
 String getDate()
          Get the scheduled date for this configuration.
 SimpleDateFormat getDateFormat()
          Deprecated. use getFormat() instead.
 long getDuration()
          Get the duration for this configuration.
 String getFormat()
          Get the format of timeout date for this task.
 boolean hasDate()
          Determine whether this schedule was initialized with a date or not.
 boolean hasDuration()
          Determine whether this schedule was initialized with a duration or not.
 Date toDate(long startDate)
          Convert this schedule to a Date object.
 long toLong(long startDate)
          Convert this schedule to a long value.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JPPFSchedule

public JPPFSchedule(long duration)
Initialize this schedule configuration with the specified duration.

Parameters:
duration - the duration in milliseconds.

JPPFSchedule

public JPPFSchedule(String date,
                    String format)
Initialize this schedule configuration with the specified duration.

Parameters:
date - the schedule date provided as a string.
format - the format in which the date is expressed (including locale and time zone information), as specified in the description of SimpleDateFormat.

JPPFSchedule

public JPPFSchedule(String date,
                    SimpleDateFormat dateFormat)
Deprecated. use JPPFSchedule(String, String) instead.

Initialize this schedule configuration with the specified duration.

Parameters:
date - the schedule date provided as a string.
dateFormat - the format in which the date is expressed (including locale and time zone information).
Method Detail

getDuration

public long getDuration()
Get the duration for this configuration. The time at which the duration starts dependends 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

public String getDate()
Get the scheduled date for this configuration.

Returns:
the date in string format.

getDateFormat

public SimpleDateFormat getDateFormat()
Deprecated. use getFormat() instead.

Get the format of timeout date for this task.

Returns:
a SimpleDateFormat instance.

getFormat

public String getFormat()
Get the format of timeout date for this task.

Returns:
the date format as a string pattern.

toDate

public Date toDate(long startDate)
            throws ParseException
Convert this schedule to a Date object.

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

public long toLong(long startDate)
            throws ParseException
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

public String toString()

Overrides:
toString in class Object

hasDate

public boolean hasDate()
Determine whether this schedule was initialized with a date or not.

Returns:
true if a date was specified when constructing this schedule, false otherwise.

hasDuration

public boolean hasDuration()
Determine whether this schedule was initialized with a duration or not.

Returns:
true if a duration (or timeout) was specified when constructing this schedule, false otherwise.


Copyright © 2005-2010 JPPF Team.