public class AsyncFileCoordinator extends AsyncCoordinator
Thread.State, Thread.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
AsyncFileCoordinator() |
Modifier and Type | Method and Description |
---|---|
void |
enqueue(AsyncTask task)
Enqueue a task object, normally you enqueue using task handler, which will then
call this method.
|
AsyncTask |
enqueue(AsyncTaskHandler handler)
Enqueue a new task runner; a task object will automatically be created for
this handler.
|
AsyncTask |
enqueue(AsyncTaskHandler handler,
String customKey,
long executeAt)
Enque a new task handler.
|
AsyncTask |
findAndLockNextTask(Long now)
Find the next task that is unlocked and ready for execution, lock it, and return it.
|
int |
getPendingTaskCount()
Get the number of tasks waiting to be executed.
|
AsyncTaskPersister |
getTaskPersister() |
PriorityBlockingQueue<AsyncTask> |
getTaskQueue() |
boolean |
hasPendingTaskWithCustomKey(String key)
Has an unexecuted task with the given custom key
|
boolean |
hasSeenTask(String id) |
boolean |
hasTaskWithCustomKey(String key)
Has any task, pending or already run, with the given custom key
|
boolean |
hasTaskWithId(Long id)
Check to see if the task with the given id exists in the queue
|
protected boolean |
lockTaskForExecution(AsyncTask task) |
boolean |
markCompleted(AsyncTask task)
Mark the task as completed.
|
boolean |
markFailed(AsyncTask task,
Throwable throwable)
Mark the task as failed.
|
void |
onLoadTaskOnBoot(AsyncTask task)
Called when a task is loaded from the data store during the boot phase.
|
void |
saveNewTask(AsyncTask task)
Save a new task to the data store
|
void |
updateTask(AsyncTask task,
boolean executeAtChanged)
Update a task with new information.
|
executeNext, executeNext, getExtraClassLoaders, gracefulShutdown, init, initAndStart, initEphemeralSynchronousForTests, initForTests, instance, isSynchronousMode, registerClassLoader, registerHandler, registerHandler, run, runTaskForId, shutDownForTests, startup
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public AsyncFileCoordinator()
public AsyncTask enqueue(AsyncTaskHandler handler)
AsyncCoordinator
enqueue
in class AsyncCoordinator
public AsyncTask enqueue(AsyncTaskHandler handler, String customKey, long executeAt)
AsyncCoordinator
enqueue
in class AsyncCoordinator
handler
- - the task handler that will be executed.customKey
- - a user generated unique key that allows you to prevent dupes or later update the taskexecuteAt
- - when you want the task to execute, in epoch millisecondspublic void enqueue(AsyncTask task)
AsyncCoordinator
enqueue
in class AsyncCoordinator
public void updateTask(AsyncTask task, boolean executeAtChanged)
AsyncCoordinator
updateTask
in class AsyncCoordinator
public void saveNewTask(AsyncTask task)
AsyncCoordinator
saveNewTask
in class AsyncCoordinator
public AsyncTask findAndLockNextTask(Long now)
AsyncCoordinator
findAndLockNextTask
in class AsyncCoordinator
protected boolean lockTaskForExecution(AsyncTask task)
public boolean markCompleted(AsyncTask task)
AsyncCoordinator
markCompleted
in class AsyncCoordinator
public boolean markFailed(AsyncTask task, Throwable throwable)
AsyncCoordinator
markFailed
in class AsyncCoordinator
public AsyncTaskPersister getTaskPersister()
getTaskPersister
in class AsyncCoordinator
public boolean hasSeenTask(String id)
public boolean hasTaskWithId(Long id)
AsyncCoordinator
hasTaskWithId
in class AsyncCoordinator
public boolean hasPendingTaskWithCustomKey(String key)
AsyncCoordinator
hasPendingTaskWithCustomKey
in class AsyncCoordinator
public boolean hasTaskWithCustomKey(String key)
AsyncCoordinator
hasTaskWithCustomKey
in class AsyncCoordinator
public PriorityBlockingQueue<AsyncTask> getTaskQueue()
public void onLoadTaskOnBoot(AsyncTask task)
AsyncCoordinator
onLoadTaskOnBoot
in class AsyncCoordinator
public int getPendingTaskCount()
AsyncCoordinator
getPendingTaskCount
in class AsyncCoordinator
Copyright © 2016. All rights reserved.