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

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

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

ConstantQueueSchedulingStrategy will compute the next schedule date by adding its intervalMillis to the current time which will be retrieved by QueueScheduler.now().

Author:
Michael "kULO" Kulovits

Field Summary
protected  int intervalMillis
           
 
Constructor Summary
ConstantQueueSchedulingStrategy(int interval)
           
 
Method Summary
 java.util.Calendar calculateNextProcessing(QueueScheduler<T> scheduler, SchedulableQueueElement<T> schedulable)
           Performs the concrete scheduling algorithm defined by this QueueSchedulingStrategy on the passed SchedulableQueueElement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

intervalMillis

protected int intervalMillis
Constructor Detail

ConstantQueueSchedulingStrategy

public ConstantQueueSchedulingStrategy(int interval)
Parameters:
intervalMillis -
Method Detail

calculateNextProcessing

public java.util.Calendar calculateNextProcessing(QueueScheduler<T> scheduler,
                                                  SchedulableQueueElement<T> schedulable)
Description copied from interface: QueueSchedulingStrategy

Performs the concrete scheduling algorithm defined by this QueueSchedulingStrategy on the passed SchedulableQueueElement.

All information needed by the algorithm should be retrieved from the passed schedulable and scheduler instances.

The passed schedulable should not be altered by this algorithm. In order to decouple the scheduling algorithm as much as possible and to preserve flexibility and reusabiltiy the schedulable should itself be responsible for changing its internal state in its SchedulableQueueElement.getScheduled(QueueScheduler) method.

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.