public class JScheduler extends Object implements Scheduler
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
.
Modifier and Type | Field and Description |
---|---|
protected org.objectweb.jonathan.apis.kernel.ContextFactory |
context_factory |
boolean |
verbose
Indicates whether warning message should be printed to stderr.
|
Constructor and Description |
---|
JScheduler(org.objectweb.jonathan.apis.kernel.ContextFactory context_factory)
Returns a new scheduler.
|
JScheduler(int max_waiting,
boolean verbose,
org.objectweb.jonathan.apis.kernel.ContextFactory context_factory)
Returns a new scheduler.
|
Modifier and Type | Method and Description |
---|---|
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)
|
void |
wait(Object lock,
long millis)
|
void |
yield()
Calling this method gives the opportunity to the scheduler to re-schedule
the currently executing jobs.
|
public boolean verbose
This value is defined under the name "/jonathan/JScheduler/verbose"
in the bootstrap context
.
This variable is not used in the current implementation.
protected org.objectweb.jonathan.apis.kernel.ContextFactory context_factory
public JScheduler(org.objectweb.jonathan.apis.kernel.ContextFactory context_factory)
context_factory
- a context factory
.public JScheduler(int max_waiting, boolean verbose, org.objectweb.jonathan.apis.kernel.ContextFactory context_factory)
max_waiting
- maximum number of idle threadsverbose
- indicates whether warning messsages should be output on
stderr.context_factory
- a context factory
.public Job newJob()
public Job getCurrent()
getCurrent
in interface Scheduler
public void yield()
This implementation calls the static yield()
method
on the Thread
class.
public void wait(Object lock) throws InterruptedException
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.InterruptedException
public void wait(Object lock, long millis) throws InterruptedException
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.InterruptedException
public void notify(Object lock)
waiting
on the lock.
This implementation calls the standard notify()
method
on the provided lock
.
public void notifyAll(Object lock)
waiting
on the lock.
This implementation calls the standard notifyAll()
method
on the provided lock
.
public void escape()
This implementation has nothing to do.