org.oddjob.schedules.schedules
Class CountSchedule

java.lang.Object
  extended byorg.oddjob.schedules.AbstractSchedule
      extended byorg.oddjob.schedules.schedules.CountSchedule
All Implemented Interfaces:
RefineableSchedule, Schedule, java.io.Serializable

public final class CountSchedule
extends AbstractSchedule
implements java.io.Serializable

Description:
This schedule returns up to count number of child schedules. It is typically used to count a number intervals for re-trying something, But could be used to count the first n days of the month for instance.

The count will be reset if the end interval changes, i.e. when counting n days of the month, and the month moves on. However in the retry situation to reset the count schedule it would need to be reset.

If the nested schedule isn't specified it defaults to NowSchedule

Example:
This would shcedule a job 5 times at intervals of 15 minutes.
 <count count="5">
   <interval interval="00:15"/>
 </count>
 
See Also:
Serialized Form
Author:
Rob Gordon

Constructor Summary
CountSchedule()
           
 
Method Summary
 java.lang.String getCount()
          Get the number to count to.
 Interval nextDue(ScheduleContext context)
          For a given date a schedule will provide the interval this schedule should next be scheduled in.
 void setCount(java.lang.String count)
          Set the number to count to.
 java.lang.String toString()
          Override toString to be more meaningful.
 
Methods inherited from class org.oddjob.schedules.AbstractSchedule
addValueSchedule, getChildSchedule, getLimits, setChildSchedule, setLimits
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CountSchedule

public CountSchedule()
Method Detail

setCount

public void setCount(java.lang.String count)
Set the number to count to.

Parameters:
count - The number to count to.

getCount

public java.lang.String getCount()
Get the number to count to.

Returns:
The number to count to.

nextDue

public Interval nextDue(ScheduleContext context)
Description copied from interface: Schedule
For a given date a schedule will provide the interval this schedule should next be scheduled in.

If the schedule is never due again for the given date, null is returned.

Specified by:
nextDue in interface Schedule
Returns:
The next due interval for the schedule.

toString

public java.lang.String toString()
Override toString to be more meaningful.