|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.androidannotations.api.BackgroundExecutor
public class BackgroundExecutor
Nested Class Summary | |
---|---|
static class |
BackgroundExecutor.Task
|
Field Summary | |
---|---|
static Executor |
DEFAULT_EXECUTOR
|
Constructor Summary | |
---|---|
BackgroundExecutor()
|
Method Summary | |
---|---|
static void |
cancelAll(String id,
boolean mayInterruptIfRunning)
Cancel all tasks having the specified id . |
static void |
execute(BackgroundExecutor.Task task)
Execute a task after (at least) its delay and after all tasks added with the same non-null serial (if any) have
completed execution. |
static void |
execute(Runnable runnable)
Execute a task. |
static void |
execute(Runnable runnable,
int delay)
Execute a task after the given delay. |
static void |
execute(Runnable runnable,
String id,
int delay,
String serial)
Execute a task. |
static void |
execute(Runnable runnable,
String id,
String serial)
Execute a task after all tasks added with the same non-null serial (if any) have completed execution. |
static void |
setExecutor(Executor executor)
Change the executor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static Executor DEFAULT_EXECUTOR
Constructor Detail |
---|
public BackgroundExecutor()
Method Detail |
---|
public static void execute(BackgroundExecutor.Task task)
serial
(if any) have
completed execution.
task
- the task to execute
IllegalArgumentException
- if task.delay
is strictly positive and the
current executor does not support scheduling (if
setExecutor(Executor)
has been called with such an
executor)public static void execute(Runnable runnable, String id, int delay, String serial)
runnable
- the task to executeid
- identifier used for task cancellationdelay
- the time from now to delay execution, in millisecondsserial
- the serial queue (null
or ""
for no
serial execution)
IllegalArgumentException
- if delay
is strictly positive and the current
executor does not support scheduling (if
setExecutor(Executor)
has been called with such an
executor)public static void execute(Runnable runnable, int delay)
runnable
- the task to executedelay
- the time from now to delay execution, in milliseconds
IllegalArgumentException
- if delay
is strictly positive and the current
executor does not support scheduling (if
setExecutor(Executor)
has been called with such an
executor)public static void execute(Runnable runnable)
runnable
- the task to executepublic static void execute(Runnable runnable, String id, String serial)
serial
(if any) have completed execution.
Equivalent to execute(runnable, id, 0, serial)
.
runnable
- the task to executeid
- identifier used for task cancellationserial
- the serial queue to use (null
or ""
for no serial execution)public static void setExecutor(Executor executor)
ScheduledExecutorService
then executing a task after a delay will not be supported anymore. If it
is not even a ExecutorService
then tasks will not be cancellable
anymore.
executor
- the new executorpublic static void cancelAll(String id, boolean mayInterruptIfRunning)
id
.
id
- the cancellation identifiermayInterruptIfRunning
- true
if the thread executing this task should be
interrupted; otherwise, in-progress tasks are allowed to
complete
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |