|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.qpid.pool.Job
public class Job
A Job is a continuation that batches together other continuations, specifically Event
s, into one continuation.
The Event
s themselves provide methods to process themselves, so processing a job simply consists of sequentially
processing all of its aggregated events.
The constructor accepts a maximum number of events for the job, and only runs up to that maximum number when
processing the job, but the add method does not enforce this maximum. In other words, not all the enqueued events
may be processed in each run of the job, several runs may be required to clear the queue.
Responsibilities | Collaborations |
---|---|
Aggregate many coninuations together into a single continuation. | |
Sequentially process aggregated continuations. | Event
|
Provide running and completion status of the aggregate continuation. | |
Execute a terminal continuation upon job completion. | JobCompletionHandler
|
Field Summary | |
---|---|
static int |
MAX_JOB_EVENTS
Defines the maximum number of events that will be batched into a single job. |
Constructor Summary | |
---|---|
Job(ReferenceCountingExecutorService poolReference,
int maxEvents,
boolean readJob)
|
Method Summary | |
---|---|
boolean |
activate()
Marks this job as active if it is inactive. |
void |
add(Runnable evt)
Enqueus a continuation for sequential processing by this job. |
void |
completed()
Implements a terminal continuation for the Job for this filter. |
void |
deactivate()
Marks this job as inactive. |
static void |
fireAsynchEvent(ExecutorService pool,
Job job,
Runnable event)
Adds an Event to a Job , triggering the execution of the job if it is not already running. |
boolean |
isComplete()
Tests if there are no more enqueued continuations to process. |
boolean |
isRead()
|
void |
notCompleted()
|
(package private) boolean |
processAll()
Sequentially processes, up to the maximum number per job, the aggregated continuations in enqueued in this job. |
void |
run()
Processes a batch of aggregated continuations, marks this job as inactive and call the terminal continuation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAX_JOB_EVENTS
Constructor Detail |
---|
public Job(ReferenceCountingExecutorService poolReference, int maxEvents, boolean readJob)
Method Detail |
---|
public void add(Runnable evt)
evt
- The continuation to enqueue.boolean processAll()
public boolean isComplete()
public boolean activate()
public void deactivate()
public void run()
run
in interface Runnable
public boolean isRead()
isRead
in interface ReadWriteRunnable
public static void fireAsynchEvent(ExecutorService pool, Job job, Runnable event)
Event
to a Job
, triggering the execution of the job if it is not already running.
job
- The job.event
- The event to hand off asynchronously.public void completed()
Job
for this filter. Whenever the Job completes its processing
of a batch of events this is called. This method simply re-activates the job, if it has more events to process.
session
- The Mina session to work in.job
- The job that completed.public void notCompleted()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |