public abstract class ConsoleTask extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ConsoleTask.AbortTaskError
Error thrown to tasks which are asked to {link #abort}.
|
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
log |
Constructor and Description |
---|
ConsoleTask() |
Modifier and Type | Method and Description |
---|---|
void |
abort()
Kill the tasks execute thread via
Thread.stop() . |
abstract boolean |
doExecute(String input)
Execute the custom task for the given input.
|
boolean |
execute(String input)
Execute a task for the given input.
|
static ConsoleTask |
get()
Get the currently running task.
|
static ConsoleTask |
get(boolean allowNull)
Get the currently running task.
|
Thread |
getExecuteThread()
Get the execution thread of the current task.
|
boolean |
isRunning()
True if the task is running (ie.
|
boolean |
isStopping()
True if
stop() was invoked. |
void |
setExecuteThread(Thread thread)
Set the execution thread of the current task.
|
void |
stop()
Ask the tasks execute thread to stop via
Thread.interrupt() . |
public boolean isRunning()
execute(java.lang.String)
was invoked).public void stop()
Thread.interrupt()
.public boolean isStopping()
stop()
was invoked.public void abort()
Thread.stop()
. Thread is given a ConsoleTask.AbortTaskError
.public boolean execute(String input) throws Exception
input
- The console input.Exception
- The console task failed.public abstract boolean doExecute(String input) throws Exception
input
- The console input.Exception
- The console task failed.public void setExecuteThread(Thread thread)
thread
- The new thread considered to be the tasks execute thread.public Thread getExecuteThread()
public static ConsoleTask get(boolean allowNull)
allowNull
- False to throw an IllegalStateException
if there is not current task.public static ConsoleTask get()
Copyright © 2008-2013 Sonatype. All Rights Reserved.