public class BasicTaskWrapper extends Object implements TaskWrapper
Modifier and Type | Field and Description |
---|---|
static int |
TASK_ACCEPTED
The task has been accepted
|
static int |
TASK_COMPLETED
The task has completed
|
static int |
TASK_NOT_ACCEPTED
The task has not been accepted
|
static int |
TASK_REJECTED
The task was rejected
|
static int |
TASK_STARTED
The task has been started
|
static int |
TASK_STOPPED
The task has been stopped
|
Modifier | Constructor and Description |
---|---|
protected |
BasicTaskWrapper()
Create a task wrapper without a task
|
|
BasicTaskWrapper(Task task)
Create a new task wrapper
|
Modifier and Type | Method and Description |
---|---|
void |
acceptTask()
The task has been accepted
|
protected long |
getElapsedTime()
Calculate the elapsed time since the task was started
|
protected String |
getStateString()
Get the state as a string
|
long |
getTaskCompletionTimeout()
The time before the task must be completed
|
int |
getTaskPriority()
The priority of the task
|
long |
getTaskStartTimeout()
The time before the task must be accepted
|
int |
getTaskWaitType()
Get the type of wait
|
boolean |
isComplete()
Is the task complete.
|
void |
rejectTask(RuntimeException e)
The task has been rejected
|
void |
run()
Called by the thread pool executor
|
protected void |
setTask(Task task)
Set thetask for this wrapper
|
void |
stopTask()
Invoked by the threadpool when it wants to stop the task
|
protected boolean |
taskAccepted()
Notify the task it has been accepted
|
protected boolean |
taskCompleted(Throwable throwable)
Notify the task it has completed
|
protected boolean |
taskRejected(RuntimeException e)
Notify the task it has been rejected
|
protected boolean |
taskStarted()
Notify the task it has started
|
protected boolean |
taskStop()
Stop the task
|
void |
waitForTask()
Wait according the wait type
|
public static final int TASK_NOT_ACCEPTED
public static final int TASK_ACCEPTED
public static final int TASK_STARTED
public static final int TASK_COMPLETED
public static final int TASK_REJECTED
public static final int TASK_STOPPED
protected BasicTaskWrapper()
public BasicTaskWrapper(Task task)
task
- the taskIllegalArgumentException
- for a null taskpublic int getTaskWaitType()
TaskWrapper
getTaskWaitType
in interface TaskWrapper
public int getTaskPriority()
TaskWrapper
getTaskPriority
in interface TaskWrapper
public long getTaskStartTimeout()
TaskWrapper
getTaskStartTimeout
in interface TaskWrapper
public long getTaskCompletionTimeout()
TaskWrapper
getTaskCompletionTimeout
in interface TaskWrapper
public void acceptTask()
TaskWrapper
acceptTask
in interface TaskWrapper
public void rejectTask(RuntimeException e)
TaskWrapper
rejectTask
in interface TaskWrapper
e
- any error associated with the rejectionpublic boolean isComplete()
TaskWrapper
isComplete
in interface TaskWrapper
public void stopTask()
TaskWrapper
stopTask
in interface TaskWrapper
public void waitForTask()
TaskWrapper
waitForTask
in interface TaskWrapper
protected void setTask(Task task)
task
- the taskprotected boolean taskAccepted()
protected boolean taskRejected(RuntimeException e)
e
- any error associated with the rejectionprotected boolean taskStarted()
protected boolean taskCompleted(Throwable throwable)
throwable
- any throwable associated with the completionprotected boolean taskStop()
protected long getElapsedTime()
protected String getStateString()
Copyright © 2018 JBoss by Red Hat. All rights reserved.