|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface QueueScheduler<T>
A QueueScheduler
manages the time of the processing of
SchedulableQueueElement
s in a queue using a
QueueSchedulingStrategy
to calculate the
date when a queue element should be processed.
The QueueScheduler
represents a mapping of
QueueSchedulingStrategy
instances to
SchedulableQueueElement
s and is not intended
to do the actual queueing or unqueueing of the elements
to be processed, neither it's responsible for the
processing itself but solely to provide (and initialize)
an apropriate QueueSchedulingStrategy
that will
do the actual computation of the next schedule date;
thus a QueueScheduler
can be seen as some kind of
strategy factory.
Neither the QueueScheduler
nor the
QueueSchedulingStrategy
are responsible for changing
the schedulable element's state, this is left to the latter
itself in its
SchedulableQueueElement.getScheduled(QueueScheduler)
method.
This should increase the reusability of schedulers and strategys.
QueueSchedulingStrategy
,
Method Summary | |
---|---|
QueueSchedulingContext<T> |
getContext(SchedulableQueueElement<T> schedulable)
Retrieves the QueueSchedulingContext for the
passed SchedulableQueueElement . |
QueueSchedulingStrategy<T> |
getSchedulingStrategy(SchedulableQueueElement<T> schedulable)
Will create and initialize/configure a new strategy instance if not yet present. |
java.util.Calendar |
now()
Creates a new Calendar with the schedulers current time
in its TimeZone representing the current time. |
Method Detail |
---|
QueueSchedulingStrategy<T> getSchedulingStrategy(SchedulableQueueElement<T> schedulable)
QueueSchedulingStrategy
instance associated
with the passed schedulable.java.util.Calendar now()
Calendar
with the schedulers current time
in its TimeZone
representing the current time.
All Calendar
instances in the context of queue scheduling
should be created through this method in order to prevent
mismatching TimeZone
s or Locale
. Furthermore
if this is used as a factory method for dates it enables
easier testing because progressing time could easily be mocked.
Calendar
with the schedulers current time
in its TimeZone
.QueueSchedulingContext<T> getContext(SchedulableQueueElement<T> schedulable)
Retrieves the QueueSchedulingContext
for the
passed SchedulableQueueElement
. If no such
context is present a new instance will be created and
registered with the QueueScheduler
.
The QueueSchedulingContext
is used to save
parameters that are associated with a specific
scheduling process.
schedulable
- - the SchedulableQueueElement
QueueSchedulingContext
instance
associated with this QueueScheduler
and the passed
SchedulableQueueElement
; never null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |