protected class NonBlockingFiniteStateMachine.Task extends Object implements Runnable, PriorityTask, KeyAssociation
SCHEDULE_FIRST, SCHEDULE_IMMEDIATE, SCHEDULE_STANDARD, TIMEOUT_DEFAULT, TIMEOUT_NONE| Constructor and Description |
|---|
Task(Event<S> event,
NonBlockingFiniteStateMachine.TaskDependencies deps)
Create a Task with given event.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
getAssociatedKey()
Determine the host key (or base) object to which this object is associated.
|
long |
getExecutionTimeoutMillis()
Obtain the maximum amount of time this task is allowed to run before
the corresponding service will attempt to stop it.
|
long |
getRequestTimeoutMillis()
Obtain the maximum amount of time a calling thread is willing to wait for
a result of the request execution.
|
int |
getSchedulingPriority()
Obtain this task's scheduling priority.
|
void |
run() |
void |
runCanceled(boolean fAbandoned)
This method will be called if and only if all attempts to interrupt this
task were unsuccessful in stopping the execution or if the execution was
canceled before it had a chance to run at all.
|
public Task(Event<S> event, NonBlockingFiniteStateMachine.TaskDependencies deps)
event - the event that needs to be processeddeps - the task dependenciespublic Object getAssociatedKey()
Note: It's expected that the returned object is suitable to be used
as an immutable identity (e.g. a key in a Map).
Note 2: Circular associations are not permitted.
getAssociatedKey in interface com.oracle.coherence.common.base.Associatedpublic int getSchedulingPriority()
getSchedulingPriority in interface PriorityTaskpublic long getExecutionTimeoutMillis()
The value of TIMEOUT_DEFAULT indicates a default
timeout value configured for the corresponding service; the value of
TIMEOUT_NONE indicates that this task can execute
indefinitely.
If, by the time the specified amount of time passed, the task has not
finished, the service will attempt to stop the execution by using the
Thread.interrupt() method. In the case that interrupting the
thread does not result in the task's termination, the
PriorityTask.runCanceled(boolean) method will be called.
getExecutionTimeoutMillis in interface PriorityTaskpublic long getRequestTimeoutMillis()
The value of TIMEOUT_DEFAULT indicates a default
timeout value configured for the corresponding service; the value of
TIMEOUT_NONE indicates that the client thread is
willing to wait indefinitely until the task execution completes or is
canceled by the service due to a task execution timeout specified by the
PriorityTask.getExecutionTimeoutMillis() value.
If the specified amount of time elapsed and the client has not received
any response from the server, an RequestTimeoutException will
be thrown to the caller.
getRequestTimeoutMillis in interface PriorityTaskpublic void runCanceled(boolean fAbandoned)
Since this method is usually called on a service thread, implementors must exercise extreme caution since any delay introduced by the implementation will cause a delay of the corresponding service.
runCanceled in interface PriorityTaskfAbandoned - true if the task has timed-out, but all attempts to
interrupt it were unsuccessful in stopping the execution;
otherwise the task was never started