|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpeersim.edsim.CDScheduler
public class CDScheduler
Schedules the first execution of the cycle based protocol instances in
the event driven engine.
It implements Control
but it will most often be invoked only
once for each protocol as an
initializer, since the scheduled events schedule themselves for the
consecutive executions (see NextCycleEvent
).
All CDProtocol
specifications in the configuration need to
contain a Scheduler
specification at least for the step size
(see config parameter "step" of
Scheduler
). This value is used as the cycle length for the
corresponding protocol.
NextCycleEvent
Parameter Summary | |
---|---|
nextcycle
Parameter that is used to define the class that is used to schedule the next cycle. |
|
protocol
The protocols that this scheduler schedules for the first execution. |
|
randstart
If set, it means that the initial execution of the given protocol is scheduled for a different random time for all nodes. |
Field Summary | |
---|---|
static Scheduler[] |
sch
Contains the scheduler objects for all CDProtocol s defined in the
configuration. |
Constructor Summary | |
---|---|
CDScheduler(java.lang.String n)
Initialization based on configuration parameters. |
Method Summary | |
---|---|
boolean |
execute()
Schedules the protocol at all nodes for the first execution adding it to the priority queue of the event driven simulation. |
protected long |
firstDelay(long cyclelength)
Returns the time (through giving the delay from the current time) when this even is first executed. |
void |
initialize(Node n)
Schedules the protocol at given node for the first execution adding it to the priority queue of the event driven simulation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Parameter Detail |
---|
nextcycle
NextCycleEvent
.
Defaults to NextCycleEvent
.
protocol
randstart
Scheduler
) of the assigned protocol.
execute()
Field Detail |
---|
public static final Scheduler[] sch
CDProtocol
s defined in the
configuration. The length of the array is the number of protocols defined,
but those entries that belong to protocols that are not CDProtocol
s
are null.
Constructor Detail |
---|
public CDScheduler(java.lang.String n)
Method Detail |
---|
public boolean execute()
firstDelay(long)
. The implementation calls initialize(peersim.core.Node)
for all nodes.
execute
in interface Control
initialize(peersim.core.Node)
public void initialize(Node n)
firstDelay(long)
, which defines the delay from the
reference point.
The reference point is the maximum of the current time, and the
value of parameter "from" of the
protocol being
scheduled. If the calculated time of the first execution
is not valid according to the schedule of the
protocol then no execution is scheduled for that protocol.
A final note: for performance reasons, the recommended practice is
not to use parameter "from"
in protocols, but
to schedule CDScheduler
itself for the desired time, whenever
possible (e.g., it is not possible if CDScheduler
is used as a
NodeInitializer
).
initialize
in interface NodeInitializer
protected long firstDelay(long cyclelength)
cyclelength
- The cycle length of the cycle based protocol
for which this method is called
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |