|
Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PriorityTask
The PriorityTask interface allows to control the ordering in which a service schedules tasks for execution using a thread pool and limit their execution times to a specified duration. Instances of PriorityTask typically also implement either Invocable
or Runnable interface. <p/> Depending on the value returned by the getSchedulingPriority()
method, the scheduling order will be one of the following:
SCHEDULE_STANDARD
- a task will be scheduled for execution in a natural (based on the request arrival time) order;SCHEDULE_FIRST
- a task will be scheduled in front of any equal or lower scheduling priority tasks and executed as soon as any of worker threads become available;SCHEDULE_IMMEDIATE
- a task will be immediately executed by any idle worker thread; if all of them are active, a new thread will be created to execute this task.A best effort will be made to limit the task execution time according to the value returned by the getExecutionTimeoutMillis()
method. However, it should be noted that:
runCanceled(boolean)
method if it's known that the client is no longer interested in the results of the task execution.In addition to allowing control of the task execution (as scheduled and measured on the server side), the PriorityTask interface could also be used to control the request time from the calling thread perspective (measured on the client). A best effort will be made to limit the request time (the time period that the calling thread is blocked waiting for a response from the corresponding service) to the value returned by the getRequestTimeoutMillis()
method. <p/> It should be noted that the request timeout value (RT) could be grater than, equal to or less than the task execution timeout value (ET). The value of RT which is less than ET indicates that even though the task execution is allowed to take longer period of time, the client thread will not wait for a result of the execution and will be able to handle a timeout exception if it arises. Since the time spent by the task waiting in the service backlog queue does not count toward the task execution time, a value of RT that is equal or slightly greater than ET still leaves a possibility that the client thread will throw a TimeoutException before the task completes its execution normally on a server.
Field Summary | |
---|---|
static int |
SCHEDULE_FIRST Scheduling value indicating that this task is to be queued in front of any equal or lower scheduling priority tasks and executed as soon as any of the worker threads become available. |
static int |
SCHEDULE_IMMEDIATE Scheduling value indicating that this task is to be immediately executed by any idle worker thread; if all of them are active, a new thread will be created to execute this task. |
static int |
SCHEDULE_STANDARD Scheduling value indicating that this task is to be queued and executed in a natural (based on the request arrival time) order. |
static long |
TIMEOUT_DEFAULT A special timeout value to indicate that the corresponding service's default timeout value should be used. |
static long |
TIMEOUT_NONE A special timeout value to indicate that this task or request can run indefinitely. |
Method Summary | |
---|---|
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 |
runCanceled(boolean 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. |
Field Detail |
---|
static final int SCHEDULE_STANDARD
static final int SCHEDULE_FIRST
static final int SCHEDULE_IMMEDIATE
static final long TIMEOUT_DEFAULT
static final long TIMEOUT_NONE
Method Detail |
---|
int getSchedulingPriority()
long getExecutionTimeoutMillis()
TIMEOUT_DEFAULT
indicates a default timeout value configured for the corresponding service; the value of TIMEOUT_NONE
indicates that this task can execute indefinitely. <p/> 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(boolean)
method will be called.long getRequestTimeoutMillis()
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 getExecutionTimeoutMillis()
value. <p/> 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.void runCanceled(boolean fAbandoned)
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
|
Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |