public abstract class PersistentJobRunnerImpl extends java.lang.Object implements PersistentJobRunner
PersistentJobRunner.CheckpointLock| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Object |
serializeCheckpoints |
| Constructor and Description |
|---|
PersistentJobRunnerImpl(Executor executor,
Ticker ticker,
long interval) |
| Modifier and Type | Method and Description |
|---|---|
void |
checkpointOffThread() |
void |
delayedCheckpoint() |
void |
disableWrite() |
protected ClientContext |
getClientContext() |
void |
handleCompletion(boolean ret,
int threadPriority) |
boolean |
hasLoaded()
Has the queue started yet?
|
protected abstract void |
innerCheckpoint(boolean shutdown) |
boolean |
isKilledOrNotLoaded() |
void |
killAndWaitForNotRunning() |
protected void |
killAndWaitForNotWriting()
Set the killed flag and wait until we are not writing
|
PersistentJobRunner.CheckpointLock |
lock()
Obtain a lock which will prevent checkpointing until it is unlocked.
|
protected void |
onLoading() |
protected void |
onStarted(boolean noWrite) |
void |
queue(PersistentJob job,
int threadPriority)
Start a job immediately unless we are about to write a checkpoint.
|
void |
queueInternal(PersistentJob job)
Start an "internal" job.
|
void |
queueInternal(PersistentJob job,
int threadPriority)
Start an "internal" job.
|
void |
queueNormalOrDrop(PersistentJob job)
Queue the job at low thread priority or drop it if persistence is disabled.
|
void |
setCheckpointASAP()
Commit ASAP.
|
void |
shutdown() |
boolean |
shuttingDown()
If true, the node is shutting down
|
void |
start(ClientContext context) |
protected void |
updateLastCheckpointed() |
void |
waitAndCheckpoint()
Wait until a checkpoint has been completed, or if the job runner becomes idle, do it here.
|
void |
waitForIdleAndCheckpoint()
Typically called after shutdown() to wait for current jobs to complete.
|
void |
waitForNotWriting() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitnewSaltpublic void start(ClientContext context)
public void queue(PersistentJob job, int threadPriority) throws PersistenceDisabledException
PersistentJobRunnerqueue in interface PersistentJobRunnerjob - The job to run now or after the checkpoint.threadPriority - The priority of the job.PersistenceDisabledException - If persistence is disabled.public void queueInternal(PersistentJob job, int threadPriority) throws PersistenceDisabledException
PersistentJobRunnerqueueInternal in interface PersistentJobRunnerPersistenceDisabledExceptionpublic void queueInternal(PersistentJob job)
PersistentJobRunnerqueueInternal in interface PersistentJobRunnerpublic void queueNormalOrDrop(PersistentJob job)
PersistentJobRunnerqueueNormalOrDrop in interface PersistentJobRunnerpublic void handleCompletion(boolean ret,
int threadPriority)
public void delayedCheckpoint()
public void checkpointOffThread()
public void setCheckpointASAP()
PersistentJobRunnersetCheckpointASAP in interface PersistentJobRunnerprotected void updateLastCheckpointed()
protected abstract void innerCheckpoint(boolean shutdown)
protected void onLoading()
protected void onStarted(boolean noWrite)
public void shutdown()
public boolean shuttingDown()
PersistentJobRunnershuttingDown in interface PersistentJobRunnerpublic void waitForIdleAndCheckpoint()
public void waitAndCheckpoint()
throws PersistenceDisabledException
PersistenceDisabledExceptionprotected void killAndWaitForNotWriting()
public void waitForNotWriting()
public void killAndWaitForNotRunning()
public boolean isKilledOrNotLoaded()
public boolean hasLoaded()
PersistentJobRunnerhasLoaded in interface PersistentJobRunnerprotected ClientContext getClientContext()
public PersistentJobRunner.CheckpointLock lock() throws PersistenceDisabledException
PersistentJobRunnerlock in interface PersistentJobRunnerPersistenceDisabledException - If we are unable to lock because the system is shutting
down.public void disableWrite()