public interface Scheduler
To allow application programmers to change the default scheduling used by Java,
and to implement some resource management policy on activity resources
(threads), Jonathan introduces abstractions to represent activities
(interface Job
) and schedulers
(interface Scheduler
).
A Job is the abstraction of an activity in the system. When this activity is sequential (the usual case), it may be thought of as a thread. The role of a scheduler is to create Jobs (a scheduler is a job factory), and to manage them according to their properties (a priority, a deadline, ...). A scheduler has thus the responsibility to associate a Job with some processing resource (which may be a processor, or more simply a Java thread) when it is entitled to run.
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.
|
Job newJob()
Job getCurrent()
void yield()
void wait(Object lock) throws InterruptedException
notify
or
notifyAll
method is called providing the
same lock identifier.lock
- the lock identifier.InterruptedException
void wait(Object lock, long millis) throws InterruptedException
notify
or
notifyAll
method is called providing the
same lock identifier.lock
- the lock identifier.InterruptedException
void notify(Object lock)
waiting
on the lock.lock
- the lock identifier.void notifyAll(Object lock)
waiting
on the lock.lock
- the lock identifier.void escape()
void enter()
"escaped"
from the scheduler to be re-admitted
in the set of jobs managed by the target scheduler.