|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SchedulableQueueElement<T>
A SchedulableQueueElement
represents an object that will
be processed in an arbitrary time based queueing mechanism.
The schedulable holds information about several timestamps in
its queueing context and thus has implicitly an assigned
TimeZone
and Locale
because Calendar
objects have to agree on them.
The schedulable for instance stores when it has been queued,
how often it has been (re-) processed, when it was processed
the last time, when there is the next date to be
processed, what's the minimum interval between two processings
and optionally a maximum schedule date.
There are some asumptions on this data:
Dates
in the actual implementation)getMinSchedulingInterval()
millis after
the last processing date, if it's not it has to be
null
The lifecycle of a SchedulableQueueElement
should look
like this:
null
The schedulable itself is responsible for updating its
properties (count, last- and next processing date) during being
scheduled by an QueueScheduler
, see
getScheduled(QueueScheduler)
; because of this there
are only getter methods in the
SchedulableQueueElement
interface - to a
QueueScheduler
or QueueSchedulingStrategy
a
schedulable element therefore "feels" like an
immutable/read-only object.
QueueScheduler
,
Method Summary | |
---|---|
java.util.Calendar |
getLastProcessing()
Returns the schedulable's last processing date. |
java.util.Calendar |
getMaxScheduleDate()
Returns the maximum schedule date which defines a date in the future and must not be exceeded on reschedulings. |
int |
getMinSchedulingInterval()
Returns the minimal scheduling interval in milliseconds that is compulsory for this SchedulableQueueElement . |
java.util.Calendar |
getNextProcessing()
Returns the next scheduled date which a priori is null . |
java.util.Calendar |
getQueueingDate()
Returns the schedulable's queueing date. |
java.util.Calendar |
getScheduled(QueueScheduler<T> scheduler)
(Re)schedules this queue element using the passed QueueScheduler . |
int |
getScheduledCount()
Returns this queue element's scheduled count. |
java.util.Calendar |
now()
Returns the schedulables notion of the current time. |
Methods inherited from interface com.emarsys.ecommon.util.GenericAdapter |
---|
getConcreteInstance |
Method Detail |
---|
java.util.Calendar now()
Returns the schedulables notion of the current time.
Might be a clone of the queueing date.
Calendar
with the schedulables current time
in its TimeZone
.java.util.Calendar getQueueingDate()
Returns the schedulable's queueing date.
The queueing date represents the timestamp when this
SchedulableQueueElement
has been added to the
queuing mechanism.
Calendar
instance representing
a date in the past, must not be null
.java.util.Calendar getLastProcessing()
Returns the schedulable's last processing date.
The last scheduled date refers to the time of the
last rescheduling, i.e. on the last call to
getScheduled(QueueScheduler)
this value should
have been set to now()
.
A priori the last scheduled date is null
.
null
.now()
java.util.Calendar getNextProcessing()
Returns the next scheduled date which a priori is null
.
null
.java.util.Calendar getMaxScheduleDate()
Returns the maximum schedule date which defines a date in the future and must not be exceeded on reschedulings.
null
if
there's no maximum restriction.int getMinSchedulingInterval()
Returns the minimal scheduling interval in milliseconds
that is compulsory for this SchedulableQueueElement
.
On getting scheduled (see getScheduled(QueueScheduler)
)
this schedulable must not set its next processing date
either to a value >= (now()
+ minSchedulingInterval)
or to null
(which is actually the dequeueing of
the schedulable queue element).
int getScheduledCount()
Returns this queue element's scheduled count.
The scheduled count specifies the number of times this
SchedulableQueueElement
got rescheduled, i.e. the
number of calls to getScheduled(QueueScheduler)
.
Thus a priori the scheduled count is 0.
SchedulableQueueElement
has been (re-)scheduled.java.util.Calendar getScheduled(QueueScheduler<T> scheduler)
(Re)schedules this queue element using the passed
QueueScheduler
.
The passed QueueScheduler
will be used to retrieve
a QueueSchedulingStrategy
for this
SchedulableQueueElement
that will be used to
calculate the date of the next processing
which will be set to the new value, see getNextProcessing()
.
Futhermore the last processing date will be set to the current
time.
The SchedulableQueueElement
must not set its next
processing date to a value that's not at least
getMinSchedulingInterval()
millis after the
last processing date
(which is now()
during
getScheduled(QueueScheduler)
).
scheduler
- - the QueueScheduler
responsible for
scheduling this instance.
QueueScheduler
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |