Skip navigation links

Oracle® Coherence Java API Reference
Release 3.6.1.0

E18814-01


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, PortableObject, Invocable, InvocableInOrder, PriorityTask, java.io.Serializable, java.lang.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
 java.lang.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.

This implementation returns TIMEOUT_DEFAULT.

 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(java.io.DataInput in)
          Restore the contents of this object by loading the object's state from the passed DataInput object.
 void readExternal(PofReader in)
          Restore the contents of a user type instance by reading its state using the specified PofReader 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.
 java.lang.String toString()
          Return a human-readable task description.
 void writeExternal(java.io.DataOutput out)
          Save the contents of this object by storing the object's state into the passed DataOutput object.
 void writeExternal(PofWriter out)
          Save the contents of a POF user type instance by writing its state using the specified PofWriter 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:
work - the Work to execute
lWorkId - the Work id
nMemberId - the Member id
fFeedback - true if a feedback is requested (listener)
Throws:
commonj.work.WorkException - thrown if serialization results in an exception

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.
See Also:
Thread.run()

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 java.lang.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(java.io.DataInput in)
                  throws java.io.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:
java.io.IOException - if an I/O exception occurs
java.io.NotActiveException - if the object is not in its initial state, and therefore cannot be deserialized into

writeExternal

public void writeExternal(java.io.DataOutput out)
                   throws java.io.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:
java.io.IOException - if an I/O exception occurs

readExternal

public void readExternal(PofReader in)
                  throws java.io.IOException
Restore the contents of a user type instance by reading its state using the specified PofReader object.
Specified by:
readExternal in interface PortableObject
Overrides:
readExternal in class WorkManager.AbstractWork
Parameters:
in - the PofReader from which to read the object's state
Throws:
java.io.IOException - if an I/O error occurs

writeExternal

public void writeExternal(PofWriter out)
                   throws java.io.IOException
Save the contents of a POF user type instance by writing its state using the specified PofWriter object.
Specified by:
writeExternal in interface PortableObject
Overrides:
writeExternal in class WorkManager.AbstractWork
Parameters:
out - the PofWriter to which to write the object's state
Throws:
java.io.IOException - if an I/O error occurs

toString

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

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.6.1.0

E18814-01


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