#include <coherence/net/AbstractInvocable.hpp>
Inherits Object, Invocable, and PriorityTask.
For Invocables which only run within the Coherence cluster (most common case), the C++ init, getResult and run methods can be left unimplemented.
Public Types | ||||
typedef spec::Handle | Handle | |||
AbstractInvocable Handle definition. | ||||
typedef spec::View | View | |||
AbstractInvocable View definition. | ||||
typedef spec::Holder | Holder | |||
AbstractInvocable Holder definition. | ||||
Public Member Functions | ||||
virtual void | init (InvocationService::Handle hService) | |||
| ||||
virtual Object::Holder | getResult () const | |||
Determine the result from the invocation of this object. This method is called by the InvocationService after the run() method returns.
| ||||
virtual void | run () | |||
Invoke the Runnable. | ||||
virtual int32_t | getSchedulingPriority () const | |||
Obtain this task's scheduling priority. Valid values are one of the SCHEDULE_* constants.
| ||||
virtual int64_t | getExecutionTimeoutMillis () const | |||
Obtain the maximum amount of time this task is allowed to run before the corresponding service will attempt to stop it. 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 runCanceled method will be called.
| ||||
virtual void | runCanceled (bool fAbandoned) | |||
This method will be called if and only if all attempts to interrupt this task were unsuccesful in stopping the execution or if the execution was canceled before it had a chance to run at all. 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.
| ||||
virtual int64_t | getRequestTimeoutMillis () const | |||
Obtain the maximum amount of time a calling thread is willing to wait for a result of the request execution. The request time is measured on the client side as the time elapsed from the moment a request is sent for execution to the corresponding server node(s) and includes:
The value of timeout_default indicates a default timeout value configured for the corresponding service; the value of timeout_none 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 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.
|
virtual void init | ( | InvocationService::Handle | hService | ) | [virtual] |
This implementation throws an UnsupportedOperationException.
virtual Object::Holder getResult | ( | ) | const [virtual] |
Determine the result from the invocation of this object.
This method is called by the InvocationService after the run() method returns.
This implementation throws an UnsupportedOperationException.
Implements Invocable.
virtual void run | ( | ) | [virtual] |
virtual int32_t getSchedulingPriority | ( | ) | const [virtual] |
Obtain this task's scheduling priority.
Valid values are one of the SCHEDULE_* constants.
This implementation returns schedule_standard.
Implements PriorityTask.
virtual int64_t getExecutionTimeoutMillis | ( | ) | const [virtual] |
Obtain the maximum amount of time this task is allowed to run before the corresponding service will attempt to stop it.
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 runCanceled method will be called.
This implementation returns timeout_default.
Implements PriorityTask.
virtual void runCanceled | ( | bool | fAbandoned | ) | [virtual] |
This method will be called if and only if all attempts to interrupt this task were unsuccesful in stopping the execution or if the execution was canceled before it had a chance to run at all.
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.
fAbandoned | true if the task has timed-out, but all attempts to interrupt it were unsuccesful in stopping the execution; otherwise the task was never started |
This implementation is a no-op.
Implements PriorityTask.
virtual int64_t getRequestTimeoutMillis | ( | ) | const [virtual] |
Obtain the maximum amount of time a calling thread is willing to wait for a result of the request execution.
The request time is measured on the client side as the time elapsed from the moment a request is sent for execution to the corresponding server node(s) and includes:
The value of timeout_default indicates a default timeout value configured for the corresponding service; the value of timeout_none 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 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.
This implementation returns timeout_default.
Implements PriorityTask.