|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.emarsys.ecommon.time.schedule.ChainElement<T>
T
- public class ChainElement<T>
A ChainElement
is a part of a
QueueSchedulingStrategyChain
and represents
some kind of an execution context.
A ChainElement
encapsulates a
QueueSchedulingStrategy
together with two
a Predicate
s on ChainElement
s.
The first one defines if said strategy should be executed
(see fires()
) if it's its turn in the
chain and the second specifies whether or not the chain
execution should proceed()
after this ChainElement
.
The ChainElement
also serves as a communication object
that transports the state of the chain execution to the next
element being executed and thus saves the current result date,
i.e. the one computed by the last strategy being executed, as
well as the SchedulableQueueElement
currently being
processed. Either the result
either the
schedulable
will be set/injected by the
QueueSchedulingStrategyChain
.
Field Summary | |
---|---|
protected org.apache.commons.collections.Predicate |
fire
|
protected org.apache.commons.collections.Predicate |
proceed
|
protected java.util.Calendar |
result
|
protected SchedulableQueueElement<T> |
schedulable
|
protected QueueSchedulingStrategy<T> |
strategy
|
Constructor Summary | |
---|---|
ChainElement(QueueSchedulingStrategy<T> strategy)
Creates a new ChainElement instance. |
Method Summary | |
---|---|
protected void |
checkInvariants()
|
protected java.lang.Object |
clone()
|
boolean |
equals(java.lang.Object that)
|
java.util.Calendar |
execute(QueueScheduler<T> scheduler)
Executes the QueueSchedulingStrategy associated with
this ChainElement and passed the schedulable
and the passed scheduler as parameters to
QueueSchedulingStrategy.calculateNextProcessing(QueueScheduler, SchedulableQueueElement) . |
boolean |
fires()
|
org.apache.commons.collections.Predicate |
getFire()
|
org.apache.commons.collections.Predicate |
getProceed()
|
java.util.Calendar |
getResult()
|
SchedulableQueueElement<T> |
getSchedulable()
|
QueueSchedulingStrategy<T> |
getStrategy()
|
int |
hashCode()
|
boolean |
proceed()
|
void |
setFire(org.apache.commons.collections.Predicate fire)
|
void |
setProceed(org.apache.commons.collections.Predicate proceed)
|
void |
setResult(java.util.Calendar result)
|
void |
setSchedulable(SchedulableQueueElement<T> schedulable)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected org.apache.commons.collections.Predicate fire
protected QueueSchedulingStrategy<T> strategy
protected org.apache.commons.collections.Predicate proceed
protected volatile SchedulableQueueElement<T> schedulable
protected volatile java.util.Calendar result
Constructor Detail |
---|
public ChainElement(QueueSchedulingStrategy<T> strategy)
ChainElement
instance.
fire
- strategy
- proceed
- Method Detail |
---|
protected void checkInvariants() throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public java.util.Calendar execute(QueueScheduler<T> scheduler) throws java.lang.IllegalStateException
QueueSchedulingStrategy
associated with
this ChainElement
and passed the schedulable
and the passed scheduler as parameters to
QueueSchedulingStrategy.calculateNextProcessing(QueueScheduler, SchedulableQueueElement)
.
Implicitly overwrites the current result
with the
new one computed.
scheduler
-
result
computed by the
execution of this strategy
.
java.lang.IllegalStateException
- - if this schedulable
is
not set at the time of the executionpublic boolean fires()
previous
-
true
if this element's
fire
Predicate
evaluates to
true
for the passed chain element,
false
otherwise.public boolean proceed()
calendar
-
true
if this element's
proceed
Predicate
evaluates to
true
for the passed chain element,
false
otherwise.public org.apache.commons.collections.Predicate getFire()
Predicate
that defines whether thispublic QueueSchedulingStrategy<T> getStrategy()
public org.apache.commons.collections.Predicate getProceed()
public java.util.Calendar getResult()
public SchedulableQueueElement<T> getSchedulable()
public void setProceed(org.apache.commons.collections.Predicate proceed)
proceed
- public void setFire(org.apache.commons.collections.Predicate fire)
fire
- public void setResult(java.util.Calendar result)
result
- public void setSchedulable(SchedulableQueueElement<T> schedulable)
schedulable
- protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
Object.clone()
public boolean equals(java.lang.Object that)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |