com.emarsys.ecommon.time.schedule
Class FixedQueueSchedulingStrategy<T>

java.lang.Object
  extended by com.emarsys.ecommon.time.schedule.FixedQueueSchedulingStrategy<T>
All Implemented Interfaces:
QueueSchedulingStrategy<T>

public class FixedQueueSchedulingStrategy<T>
extends java.lang.Object
implements QueueSchedulingStrategy<T>

The FixedQueueSchedulingStrategy will "calculate" the next processing date by just setting its fixed scheduleDate.

See calculateNextProcessing(QueueScheduler, SchedulableQueueElement) for details.

Author:
Michael "kULO" Kulovits

Field Summary
protected  java.util.Calendar scheduleDate
           
 
Constructor Summary
FixedQueueSchedulingStrategy(java.util.Calendar scheduleDate)
          Creates a new FixedQueueSchedulingStrategy initialized with the passed, fixed schedule date.
 
Method Summary
 java.util.Calendar calculateNextProcessing(QueueScheduler<T> scheduler, SchedulableQueueElement<T> schedulable)
          If this scheduleDate is after (see Calendar.after(Object)) NOW (see QueueScheduler.now() then it will be returned, otherwise NOW + SchedulableQueueElement.getMinSchedulingInterval() will be returned.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scheduleDate

protected java.util.Calendar scheduleDate
Constructor Detail

FixedQueueSchedulingStrategy

public FixedQueueSchedulingStrategy(java.util.Calendar scheduleDate)
Creates a new FixedQueueSchedulingStrategy initialized with the passed, fixed schedule date.

Parameters:
scheduleDate - - the fixed schedule date
Method Detail

calculateNextProcessing

public java.util.Calendar calculateNextProcessing(QueueScheduler<T> scheduler,
                                                  SchedulableQueueElement<T> schedulable)
If this scheduleDate is after (see Calendar.after(Object)) NOW (see QueueScheduler.now() then it will be returned, otherwise NOW + SchedulableQueueElement.getMinSchedulingInterval() will be returned. This behavior is necessary because upcoming processing dates in the past does not make sense.

Specified by:
calculateNextProcessing in interface QueueSchedulingStrategy<T>
Parameters:
scheduler - - the QueueScheduler that is associated with this strategy instance
schedulable - - the SchedulableQueueElement that will be (re)scheduled
Returns:
the next scheduled date for the passed SchedulableQueueElement

See Also:
QueueSchedulingStrategy.calculateNextProcessing(com.emarsys.ecommon.time.schedule.QueueScheduler, com.emarsys.ecommon.time.schedule.SchedulableQueueElement)


Copyright © 2010 emarsys AG. All Rights Reserved.