Skip navigation links

Oracle® Coherence Java API Reference
Release 3.6.0.0

E15725-01


com.tangosol.net
Class AbstractInvocable

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.net.AbstractInvocable

All Implemented Interfaces:
Invocable, InvocableInOrder, PriorityTask, Serializable, Runnable
Direct Known Subclasses:
AbstractHttpSessionCollection.ExitAgent, LogThreadsHoldingLockAgent, PortalCacheProvider.FlushAgent, WorkManager.AbstractWork, WorkManager.CollectMembershipInfo

public abstract class AbstractInvocable
extends Base
implements Invocable, InvocableInOrder, PriorityTask, Serializable

An abstract base for Invocable and PriorityTask implementations.

Since:
Coherence 2.2
Author:
gg 2003.03.31, 2007.03.11

Field Summary

 

Fields inherited from interface com.tangosol.net.PriorityTask
SCHEDULE_FIRST, SCHEDULE_IMMEDIATE, SCHEDULE_STANDARD, TIMEOUT_DEFAULT, TIMEOUT_NONE

 

Constructor Summary
AbstractInvocable()
           

 

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. This implementation returns TIMEOUT_DEFAULT.
 long getRequestTimeoutMillis()
          Obtain the maximum amount of time a calling thread is willing to wait for a result of the request execution. This implementation returns TIMEOUT_DEFAULT.
 Object getResult()
          Determine the result from the invocation of this object.
 int getSchedulingPriority()
          Obtain this task's scheduling priority. This implementation returns SCHEDULE_STANDARD.
 InvocationService getService()
          Obtain the containing InvocationService.
 void init(InvocationService service)
          Called by the InvocationService exactly once on this Invocable object as part of its initialization.
 boolean isRespondInOrder()
          Determine whether this Invocable object has to preserve the order of responses according to the order of requests. This implementation returns "false".
 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. This implementation is a no-op.
protected  void setResult(Object oResult)
          Set the result of the invocation.

 

Constructor Detail

AbstractInvocable

public AbstractInvocable()

Method Detail

init

public void init(InvocationService service)
Called by the InvocationService exactly once on this Invocable object as part of its initialization.
Specified by:
init in interface Invocable
Parameters:
service - the containing InvocationService

getResult

public Object getResult()
Determine the result from the invocation of this object. This method is called by the InvocationService after the run method returns.
Specified by:
getResult in interface Invocable
Returns:
the invocation result, if any

isRespondInOrder

public boolean isRespondInOrder()
Determine whether this Invocable object has to preserve the order of responses according to the order of requests.

This implementation returns "false".

Specified by:
isRespondInOrder in interface InvocableInOrder
Returns:
true if the response order must be preserved; false otherwise

getSchedulingPriority

public int getSchedulingPriority()
Obtain this task's scheduling priority. Valid values are one of the SCHEDULE_* constants.

This implementation returns SCHEDULE_STANDARD.

Specified by:
getSchedulingPriority in interface PriorityTask
Returns:
this task's scheduling priority

getExecutionTimeoutMillis

public long getExecutionTimeoutMillis()
Obtain the maximum amount of time this task is allowed to run before the corresponding service will attempt to stop it. <p/> 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. <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 PriorityTask.runCanceled(boolean) method will be called.

This implementation returns TIMEOUT_DEFAULT.

Specified by:
getExecutionTimeoutMillis in interface PriorityTask
Returns:
the execution timeout value in millisecods or one of the special TIMEOUT_* values

runCanceled

public 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. <p/> 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.

Specified by:
runCanceled in interface PriorityTask
Parameters:
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

getRequestTimeoutMillis

public long getRequestTimeoutMillis()
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: <p/> 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. <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.

This implementation returns TIMEOUT_DEFAULT.

Specified by:
getRequestTimeoutMillis in interface PriorityTask
Returns:
the request timeout value in milliseconds or one of the special TIMEOUT_* values

getService

public InvocationService getService()
Obtain the containing InvocationService.
Returns:
the containing InvocationService

setResult

protected void setResult(Object oResult)
Set the result of the invocation.
Parameters:
oResult - the invocation result

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.6.0.0

E15725-01


Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.