org.objectweb.jonathan.resources.lib
Class JScheduler
- Scheduler
Default
scheduler
implementation.
This implementation has exactly the same behaviour as the default Java
scheduling.
This scheduler manages a pool of re-usable threads. The size of this pool may
be customized in the
bootstrap context
.
protected ContextFactory | context_factory
|
boolean | verbose - Indicates whether warning message should be printed to stderr.
|
JScheduler(ContextFactory context_factory) - Returns a new scheduler.
|
JScheduler(int max_waiting, boolean verbose, ContextFactory context_factory) - Returns a new scheduler.
|
void | enter() - Causes a job
"escaped" from the scheduler to be re-admitted
in the set of jobs managed by the target scheduler.
|
void | escape() - Causes the calling job to be removed from the set of jobs managed by the
target scheduler.
|
Job | getCurrent() - Returns the currently executing job (the job performing the call).
|
Job | newJob() - Returns a new job created by the scheduler.
|
void | notify(Object lock) - Unblocks a job
waiting on the lock.
|
void | notifyAll(Object lock) - Unblocks all jobs
waiting on the lock.
|
void | wait(Object lock) - Blocks the calling job until the
notify or
notifyAll method is called providing the
same lock identifier.
|
void | wait(Object lock, long millis) - Blocks the calling job until the
notify or
notifyAll method is called providing the
same lock identifier.
|
void | yield() - Calling this method gives the opportunity to the scheduler to re-schedule
the currently executing jobs.
|
context_factory
protected ContextFactory context_factory
verbose
public boolean verbose
Indicates whether warning message should be printed to stderr.
This value is defined under the name "/jonathan/JScheduler/verbose"
in the
bootstrap context
.
This variable is not used in the current implementation.
JScheduler
public JScheduler(ContextFactory context_factory)
Returns a new scheduler.
context_factory
- a context factory
.
JScheduler
public JScheduler(int max_waiting,
boolean verbose,
ContextFactory context_factory)
Returns a new scheduler.
max_waiting
- maximum number of idle threadsverbose
- indicates whether warning messsages should be output on
stderr.context_factory
- a context factory
.
enter
public void enter()
Causes a job
"escaped"
from the scheduler to be re-admitted
in the set of jobs managed by the target scheduler.
This implementation has nothing to do.
- enter in interface Scheduler
escape
public void escape()
Causes the calling job to be removed from the set of jobs managed by the
target scheduler. It is necessary to call this method before every possibly
blocking method so that the scheduler can give a chance to run to another job.
This implementation has nothing to do.
- escape in interface Scheduler
getCurrent
public Job getCurrent()
Returns the currently executing job (the job performing the call).
- getCurrent in interface Scheduler
- the currently executing job.
newJob
public Job newJob()
Returns a new job created by the scheduler.
- newJob in interface Scheduler
- a new job created by the scheduler.
notify
public void notify(Object lock)
Unblocks a job
waiting
on the lock.
This implementation calls the standard
notify()
method
on the provided
lock
.
- notify in interface Scheduler
lock
- the lock identifier.
notifyAll
public void notifyAll(Object lock)
Unblocks all jobs
waiting
on the lock.
This implementation calls the standard
notifyAll()
method
on the provided
lock
.
- notifyAll in interface Scheduler
lock
- the lock identifier.
wait
public void wait(Object lock)
throws InterruptedException
Blocks the calling job until the
notify
or
notifyAll
method is called providing the
same lock identifier.
This implementation calls the standard
wait()
method
on the provided
lock
.
- wait in interface Scheduler
lock
- the lock identifier.
wait
public void wait(Object lock,
long millis)
throws InterruptedException
Blocks the calling job until the
notify
or
notifyAll
method is called providing the
same lock identifier.
This implementation calls the standard
wait()
method
on the provided
lock
.
- wait in interface Scheduler
lock
- the lock identifier.
yield
public void yield()
Calling this method gives the opportunity to the scheduler to re-schedule
the currently executing jobs.
This implementation calls the static
yield()
method
on the
Thread
class.
- yield in interface Scheduler