| Constructor and Description |
|---|
LongTaskExecutor(boolean doInBackground)
Creates a new long task executor.
|
LongTaskExecutor(boolean doInBackground,
String name)
Creates a new long task executor.
|
LongTaskExecutor(boolean doInBackground,
String name,
int interruptDelay)
Creates a new long task executor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancel the current task.
|
void |
execute(LongTask task,
Runnable runnable)
Execute a long task with cancel and progress support.
|
void |
execute(LongTask task,
Runnable runnable,
String taskName,
LongTaskErrorHandler errorHandler)
Execute a long task with cancel and progress support.
|
boolean |
isRunning()
Returns
true if the executor is executing a task. |
void |
setDefaultErrorHandler(LongTaskErrorHandler errorHandler)
Set the default error handler.
|
void |
setLongTaskListener(LongTaskListener listener)
Set the listener to this executor.
|
public LongTaskExecutor(boolean doInBackground,
String name,
int interruptDelay)
doInBackground - when true, the task will be executed
in a separate threadname - the name of the executor, used to recognize threads by namesinterruptDelay - number of seconds to wait before * calling
Thread.interrupt() after a cancel requestpublic LongTaskExecutor(boolean doInBackground,
String name)
doInBackground - doInBackground when true, the task
will be executed in a separate threadname - the name of the executor, used to recognize threads by namespublic LongTaskExecutor(boolean doInBackground)
doInBackground - doInBackground when true, the task
will be executed in a separate threadpublic void execute(LongTask task, Runnable runnable, String taskName, LongTaskErrorHandler errorHandler)
null. In this case runnable will be executed
normally, but without cancel and progress support.task - the task to be executed, can be null.runnable - the runnable to be executedtaskName - the name of the task, is displayed in the status bar if
availableerrorHandler - error handler for exception retrieval during
executionNullPointerException - if runnable * or
taskName is nullIllegalStateException - if a task is still executing at this timepublic void execute(LongTask task, Runnable runnable)
null. In this case runnable will be executed
normally, but without cancel and progress support.task - the task to be executed, can be null.runnable - the runnable to be executedNullPointerException - if runnable is nullIllegalStateException - if a task is still executing at this timepublic void cancel()
interruptDelay has been specified, the task will be
interrupted after interruptDelay. Using
Thread.interrupt() may cause hazardous behaviors and should
be avoided. Therefore any task should be cancelable.public boolean isRunning()
true if the executor is executing a task.true if a task is running, false
otherwisepublic void setLongTaskListener(LongTaskListener listener)
listener - a listener for this executorpublic void setDefaultErrorHandler(LongTaskErrorHandler errorHandler)
errorHandler - the default error handlerCopyright © 2007–2015 Gephi Consortium. All rights reserved.