CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.coherence.commonj
Class WorkManager.ScheduleWork

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.net.AbstractInvocable
          extended by com.tangosol.coherence.commonj.WorkManager.AbstractWork
              extended by com.tangosol.coherence.commonj.WorkManager.ScheduleWork
All Implemented Interfaces:
ExternalizableLite, Invocable, InvocableInOrder, PriorityTask, Serializable, Runnable
Enclosing class:
WorkManager

protected static class WorkManager.ScheduleWork
extends WorkManager.AbstractWork

Invocable task that posts a wrapped Work object to a WorkManager queue.


Field Summary
 
Fields inherited from class com.tangosol.coherence.commonj.WorkManager.AbstractWork
m_lWorkId, m_nMemberId
 
Fields inherited from interface com.tangosol.net.PriorityTask
SCHEDULE_FIRST, SCHEDULE_IMMEDIATE, SCHEDULE_STANDARD, TIMEOUT_DEFAULT, TIMEOUT_NONE
 
Constructor Summary
WorkManager.ScheduleWork()
          Default constructor (necessary for a lite serialization).
WorkManager.ScheduleWork(commonj.work.Work work, long lWorkId, int nMemberId, boolean fFeedback)
          Construct the ScheduleWork for a given Work.
 
Method Summary
 Throwable getException()
          Return a deserialization exception (if any).
 long getExecutionTimeoutMillis()
          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 PriorityTask.runCanceled(boolean) method will be called.

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

This implementation returns SCHEDULE_STANDARD.

 int getStatus()
          Return a status of the undrlying Work.
 commonj.work.Work getWork()
          Return a Work object.
 void init(InvocationService service)
          Called by the InvocationService exactly once on this Invocable object as part of its initialization.
 boolean isFeedbackRequested()
          Return a feedback flag.
 void readExternal(DataInput in)
          Restore the contents of this object by loading the object's state from the passed DataInput object.
 void run()
          Called exactly once by the InvocationService to invoke this Invocable object.
 void setStatus(int nStatus)
          Change a status of the underlying Work.
 String toString()
          Return a human-readable task description.
 void writeExternal(DataOutput out)
          Save the contents of this object by storing the object's state into the passed DataOutput object.
 
Methods inherited from class com.tangosol.coherence.commonj.WorkManager.AbstractWork
getMember, getMemberId, getWorkId
 
Methods inherited from class com.tangosol.net.AbstractInvocable
getRequestTimeoutMillis, getResult, getService, isRespondInOrder, runCanceled, setResult
 

Constructor Detail

WorkManager.ScheduleWork

public WorkManager.ScheduleWork()
Default constructor (necessary for a lite serialization).


WorkManager.ScheduleWork

public WorkManager.ScheduleWork(commonj.work.Work work,
                                long lWorkId,
                                int nMemberId,
                                boolean fFeedback)
                         throws commonj.work.WorkException
Construct the ScheduleWork for a given Work.

Parameters:
fFeedback - true if a feedback is requested (listener)
Throws:
commonj.work.WorkException
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
Overrides:
init in class AbstractInvocable
Parameters:
service - the containing InvocationService

run

public void run()
Called exactly once by the InvocationService to invoke this Invocable object.


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
Overrides:
getSchedulingPriority in class WorkManager.AbstractWork
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.

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 PriorityTask.runCanceled(boolean) method will be called.

This implementation returns TIMEOUT_DEFAULT.

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

getWork

public commonj.work.Work getWork()
Return a Work object.

Returns:
a Work object

getException

public Throwable getException()
Return a deserialization exception (if any).

Returns:
an exception thrown duirng the Work deserialization

isFeedbackRequested

public boolean isFeedbackRequested()
Return a feedback flag.

Returns:
a feedback flag

getStatus

public int getStatus()
Return a status of the undrlying Work.

Returns:
a status of the undrlying Work

setStatus

public void setStatus(int nStatus)
Change a status of the underlying Work.

Parameters:
nStatus - a new status of the underlying Work

readExternal

public void readExternal(DataInput in)
                  throws IOException
Restore the contents of this object by loading the object's state from the passed DataInput object.

Specified by:
readExternal in interface ExternalizableLite
Overrides:
readExternal in class WorkManager.AbstractWork
Parameters:
in - the DataInput stream to read data from in order to restore the state of this object
Throws:
IOException - if an I/O exception occurs
NotActiveException - if the object is not in its initial state, and therefore cannot be deserialized into

writeExternal

public void writeExternal(DataOutput out)
                   throws IOException
Save the contents of this object by storing the object's state into the passed DataOutput object.

Specified by:
writeExternal in interface ExternalizableLite
Overrides:
writeExternal in class WorkManager.AbstractWork
Parameters:
out - the DataOutput stream to write the state of this object to
Throws:
IOException - if an I/O exception occurs

toString

public String toString()
Return a human-readable task description.


CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation