Oracle® Fusion Middleware .NET API Reference for Oracle Coherence
12c (12.2.1.4.0)
E90869-02
The IPriorityTask 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.

Namespace: Tangosol.Net
Assembly: Coherence (in Coherence.dll) Version: 12.2.1.4014 (12.2.1.4014)

Syntax

C#
public interface IPriorityTask

Remarks

Instances of IPriorityTask typically also implement either IInvocable or IRunnable interface.

Depending on the value of SchedulingPriority property, the scheduling order will be one of the following:

  • Standard - a task will be scheduled for execution in a natural (based on the request arrival time) order;
  • 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;
  • 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 of the ExecutionTimeoutMillis property. However,it should be noted that:

  • for tasks with the scheduling priority of Immediate, factors that could make the execution time longer than the timeout value are long GC pauses and high network latency;
  • if the service has a task backlog (when there are more tasks scheduled for execution than the number of available worker threads), the request execution time (measured from the client's perspective) for tasks with the scheduling priorities of Standard or First could be longer and include the time those tasks were kept in a queue before invocation;
  • the corresponding service is free to cancel the task execution before the task is started and call the 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 IPriorityTask 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 of the RequestTimeoutMillis property.

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.

See Also