public abstract class JobProcessorAdapter extends java.lang.Object implements JobProcessor
| Modifier and Type | Field and Description |
|---|---|
protected @Nullable JobProcessorExceptionHandler |
exceptionHandler |
protected java.util.concurrent.atomic.AtomicBoolean |
finished |
protected @Nullable jetbrains.exodus.core.execution.JobHandler[] |
jobFinishedHandlers |
protected @Nullable jetbrains.exodus.core.execution.JobHandler[] |
jobStartingHandlers |
protected java.util.concurrent.atomic.AtomicBoolean |
started |
| Modifier | Constructor and Description |
|---|---|
protected |
JobProcessorAdapter() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterProcessingJob(@NotNull Job job) |
void |
beforeProcessingJob(@NotNull Job job) |
protected void |
executeJob(@Nullable Job job) |
void |
finish() |
@Nullable JobProcessorExceptionHandler |
getExceptionHandler() |
boolean |
isFinished() |
boolean |
isSuspended() |
protected void |
processorFinished() |
protected void |
processorStarted() |
protected abstract boolean |
push(Job job,
Priority priority) |
protected abstract Job |
pushAt(Job job,
long millis) |
boolean |
queue(Job job)
Queues a job for execution with the normal (default) priority.
|
boolean |
queue(Job job,
Priority priority)
Queues a job for execution with specified priority.
|
Job |
queueAt(Job job,
long millis)
Queues a job for execution at specified time.
|
Job |
queueIn(Job job,
long millis)
Queues a job for execution in specified time.
|
protected abstract boolean |
queueLowest(@NotNull Job job) |
protected abstract boolean |
queueLowestTimed(@NotNull Job job) |
void |
resume() |
void |
setExceptionHandler(@Nullable JobProcessorExceptionHandler handler) |
void |
suspend() |
void |
waitForJobs(long spinTimeout) |
boolean |
waitForLatchJob(LatchJob latchJob,
long spinTimeout) |
boolean |
waitForLatchJob(LatchJob latchJob,
long spinTimeout,
Priority priority) |
void |
waitForTimedJobs(long spinTimeout) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCurrentJob, getCurrentJobStartedAt, getPendingJobs, pendingJobs, pendingTimedJobs, startprotected final java.util.concurrent.atomic.AtomicBoolean started
protected final java.util.concurrent.atomic.AtomicBoolean finished
@Nullable protected @Nullable JobProcessorExceptionHandler exceptionHandler
@Nullable protected @Nullable jetbrains.exodus.core.execution.JobHandler[] jobStartingHandlers
@Nullable protected @Nullable jetbrains.exodus.core.execution.JobHandler[] jobFinishedHandlers
public boolean isFinished()
isFinished in interface JobProcessorpublic void setExceptionHandler(@Nullable
@Nullable JobProcessorExceptionHandler handler)
setExceptionHandler in interface JobProcessor@Nullable public @Nullable JobProcessorExceptionHandler getExceptionHandler()
getExceptionHandler in interface JobProcessorpublic final boolean queue(Job job)
queue in interface JobProcessorjob - job to execute.public final boolean queue(Job job, Priority priority)
queue in interface JobProcessorjob - job to execute.priority - priority if the job in the job queue.public final Job queueAt(Job job, long millis)
queueAt in interface JobProcessorjob - the job.millis - time to execute the job.public final Job queueIn(Job job, long millis)
queueIn in interface JobProcessorjob - the job.millis - execute the job in this time.public void finish()
finish in interface JobProcessorpublic void waitForJobs(long spinTimeout)
waitForJobs in interface JobProcessorpublic void waitForTimedJobs(long spinTimeout)
waitForTimedJobs in interface JobProcessorpublic void suspend()
throws java.lang.InterruptedException
suspend in interface JobProcessorjava.lang.InterruptedExceptionpublic void resume()
resume in interface JobProcessorpublic boolean isSuspended()
isSuspended in interface JobProcessorpublic void beforeProcessingJob(@NotNull
@NotNull Job job)
beforeProcessingJob in interface JobProcessorpublic void afterProcessingJob(@NotNull
@NotNull Job job)
afterProcessingJob in interface JobProcessorprotected abstract boolean queueLowest(@NotNull
@NotNull Job job)
protected abstract boolean queueLowestTimed(@NotNull
@NotNull Job job)
public boolean waitForLatchJob(LatchJob latchJob, long spinTimeout, Priority priority)
public boolean waitForLatchJob(LatchJob latchJob, long spinTimeout)
protected void processorStarted()
protected void processorFinished()
protected void executeJob(@Nullable
@Nullable Job job)