|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimple.util.schedule.Scheduler
simple.util.schedule.PulseScheduler
public class PulseScheduler
The PulseScheduler
is a scheduler that is used when
the time accuracy is not of great importance. This will ensure that
the scheduled items can be dequeued in pulses.
The aim of this type of Scheduler
is to allow a large
number of items to be enqueued using a large number of threads.
The fact that there is a large number of threads means that the
Registry
will issue a large number of interrupts to
dequeuers. The aim of the PulseScheduler
is to ensure
that the number of thread interrupts issued is kept low.
It achives this by ensuring that threads that are enqueuing objects
have timeouts that are rounded to the nearest pulse. The effect that
this has is that many objects will be enqueued with the same timeout
values. When an enqueue is invoked the Registry
is looked
up to see if there is a thread dequeuing that has a larger timeout, if
the timeouts are rounded then the Registry
will see that
there are few threads that are dequeuing with larger timeout values an
interrupt will not be issued.
Care should be taken when choosing this type of Scheduler
,
large performance decreases can be incurred if the problem does not fit
with the PulseScheduler
. For most problems the default
Scheduler
is a better choice. This has a default maximum
timeout of one minute and a default pulse of one hundred ms.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class simple.util.schedule.Scheduler |
---|
Scheduler.Entry |
Field Summary | |
---|---|
protected static long |
DEFAULT_FREQ
The default frequency with which times are rounded. |
protected long |
half
This is just a simple operation saving variable. |
protected long |
pulse
The frequency that this Scheduler uses. |
Fields inherited from class simple.util.schedule.Scheduler |
---|
DEFAULT_MAX, max, queue, registry |
Constructor Summary | |
---|---|
PulseScheduler()
This creates a PulseScheduler to schedule objects. |
|
PulseScheduler(long max)
This creates a PulseScheduler to schedule objects. |
|
PulseScheduler(long max,
long freq)
This creates a PulseScheduler to schedule objects. |
Method Summary | |
---|---|
protected void |
enqueue(Scheduler.Entry entry)
This just adds some changes to the superclasses version of the enqueue method. |
Methods inherited from class simple.util.schedule.Scheduler |
---|
currentTime, dequeue, enqueue, interrupt, register, sleep, unregister |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final long DEFAULT_FREQ
protected long pulse
Scheduler
uses.
protected long half
Constructor Detail |
---|
public PulseScheduler()
PulseScheduler
to schedule objects.
This type of Scheduler
is used to keep the interrupt
rate low for threads. The PulseScheduler
keeps the
interrupt rate low by rounding the timeouts that objects are
scheduled for to the next pulse timeout.
public PulseScheduler(long max)
PulseScheduler
to schedule objects.
This type of Scheduler
is used to keep the interrupt
rate low for threads. The PulseScheduler
keeps the
interrupt rate low by rounding the timeouts that objects are
scheduled for to the next pulse timeout.
max
- this is the maximum timeout that an object can havepublic PulseScheduler(long max, long freq)
PulseScheduler
to schedule objects.
This type of Scheduler
is used to keep the interrupt
rate low for threads. The PulseScheduler
keeps the
interrupt rate low by rounding the timeouts that objects are
scheduled for to the next pulse timeout.
freq
- this is the frequency of the pulses for this
Scheduler
max
- this is the maximum timeout that an object can haveMethod Detail |
---|
protected void enqueue(Scheduler.Entry entry)
enqueue
in class Scheduler
entry
- this is the entry object that is being scheduled
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |