|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Schedulers are used to create and schedule Jobs.
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.
Method Summary | |
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. |
Method Detail |
public Job newJob()
public Job getCurrent()
public void yield()
public void wait(Object lock) throws InterruptedException
notify
or
notifyAll
method is called providing the
same lock identifier.
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.
lock
- the lock identifier.
InterruptedException
public void notify(Object lock)
waiting
on the lock.
lock
- the lock identifier.public void notifyAll(Object lock)
waiting
on the lock.
lock
- the lock identifier.public void escape()
public void enter()
"escaped"
from the scheduler to be re-admitted
in the set of jobs managed by the target scheduler.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |