Show / Hide Table of Contents

Class AbstractInvocable

An abstract base for IInvocable and IPriorityTask implementations.

Inheritance
object
AbstractInvocable
Implements
IInvocable
IPortableObject
IPriorityTask
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Tangosol.Net
Assembly: Coherence.dll
Syntax
public abstract class AbstractInvocable : IInvocable, IPortableObject, IPriorityTask
Remarks

For Invocables which only run within the Coherence cluster (most common case), the .NET Init, Result and Run methods can be left unimplemented.

Properties

ExecutionTimeoutMillis

The maximum amount of time this task is allowed to run before the corresponding service will attempt to stop it.

Declaration
public long ExecutionTimeoutMillis { get; }
Property Value
Type Description
long

The execution timeout value in millisecods or one of the special PriorityTaskTimeout values.

Remarks

The value of Default indicates a default timeout value configured for the corresponding service; the value of 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(bool) method will be called.

This implementation returns Default

RequestTimeoutMillis

The maximum amount of time a calling thread is willing to wait for a result of the request execution.

Declaration
public long RequestTimeoutMillis { get; }
Property Value
Type Description
long

The request timeout value in milliseconds or one of the special PriorityTaskTimeout values.

Remarks

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 time it takes to deliver the request to the executing node(s);
  • the interval between the time the task is received and placed into a service queue until the execution starts;
  • the task execution time;
  • the time it takes to deliver a result back to the client.

The value of Default indicates a default timeout value configured for the corresponding service; the value of 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 ExecutionTimeoutMillis value.

If the specified amount of time elapsed and the client has not received any response from the server, a RequestTimeoutException will be thrown to the caller.

This implementation returns Default

Result

Gets or sets the result of the invocation of this object.

Declaration
public object Result { get; set; }
Property Value
Type Description
object

The object representing result from the invocation.

Remarks

This property value is read after the Run() method returns.

SchedulingPriority

This task's scheduling priority.

Declaration
public PriorityTaskScheduling SchedulingPriority { get; }
Property Value
Type Description
PriorityTaskScheduling

One of the PriorityTaskScheduling constants.

Remarks

This implementation returns Standard.

Service

Obtain the containing IInvocationService.

Declaration
public IInvocationService Service { get; }
Property Value
Type Description
IInvocationService

The containing IInvocationService.

Methods

Init(IInvocationService)

Called by the IInvocationService exactly once on this IInvocable object as part of its initialization.

Declaration
public virtual void Init(IInvocationService service)
Parameters
Type Name Description
IInvocationService service

The containing InvocationService.

Remarks

Note: implementations of the IInvocable interface that store the service reference must do so only in a transient field.

ReadExternal(IPofReader)

Restore the contents of a user type instance by reading its state using the specified IPofReader object.

Declaration
public abstract void ReadExternal(IPofReader reader)
Parameters
Type Name Description
IPofReader reader

The IPofReader from which to read the object's state.

Exceptions
Type Condition
IOException

If an I/O error occurs.

Run()

Execute the action specific to the object implementation.

Declaration
public virtual void Run()
Remarks

This implementation throws a NotSupportedException.

RunCanceled(bool)

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.

Declaration
public virtual void RunCanceled(bool isAbandoned)
Parameters
Type Name Description
bool isAbandoned

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.

Remarks

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.

This implementation is a no-op.

WriteExternal(IPofWriter)

Save the contents of a POF user type instance by writing its state using the specified IPofWriter object.

Declaration
public abstract void WriteExternal(IPofWriter writer)
Parameters
Type Name Description
IPofWriter writer

The IPofWriter to which to write the object's state.

Exceptions
Type Condition
IOException

If an I/O error occurs.

Implements

IInvocable
IPortableObject
IPriorityTask
In this article
Back to top Copyright © 2000, 2024, Oracle and/or its affiliates.