| java.lang.Object org.jgroups.util.Scheduler
Scheduler | public class Scheduler implements Runnable(Code) | | Implementation of a priority scheduler. The scheduler maintains a queue to the end of which
all tasks are added. It continually looks at the first queue element, assigns a thread to
it, runs the thread and waits for completion. When a new priority task is added,
it will be added to the head of the queue and the scheduler will be interrupted. In this
case, the currently handled task is suspended, and the one at the head of the queue
handled. This is recursive: a priority task can always be interrupted by another priority
task. Resursion ends when no more priority tasks are added, or when the thread pool is
exhausted.
author: Bela Ban |
Inner Class :public static class Task | |
NUM_THREADS | int NUM_THREADS(Code) | | max number of threads, will only be allocated when needed
|
THREAD_JOIN_TIMEOUT | final static int THREAD_JOIN_TIMEOUT(Code) | | |
WAIT_FOR_THREAD_AVAILABILITY | final static int WAIT_FOR_THREAD_AVAILABILITY(Code) | | |
concurrent_processing | boolean concurrent_processing(Code) | | Process items on the queue concurrently. The default is to wait until the processing of an item
has completed before fetching the next item from the queue. Note that setting this to true
may destroy the properties of a protocol stack, e.g total or causal order may not be
guaranteed. Set this to true only if you know what you're doing !
|
current_task | Task current_task(Code) | | |
log | final protected static Log log(Code) | | |
Scheduler | public Scheduler()(Code) | | |
Scheduler | public Scheduler(int num_threads)(Code) | | |
getConcurrentProcessing | public boolean getConcurrentProcessing()(Code) | | |
setConcurrentProcessing | public void setConcurrentProcessing(boolean process_concurrently)(Code) | | |
start | public void start()(Code) | | |
stop | public void stop()(Code) | | Stop the scheduler thread. The thread may be waiting for its next task (queue.peek()) or it may be waiting on
the currently executing thread. In the first case, closing the queue will throw a QueueClosed exception which
terminates the scheduler thread. In the second case, after closing the queue, we interrupt the scheduler thread,
which then checks whether the queue is closed. If this is the case, the scheduler thread terminates.
|
|
|