com.gigaspaces.grid.master
Class Task

java.lang.Object
  extended by com.gigaspaces.grid.master.Task
All Implemented Interfaces:
java.io.Serializable, net.jini.core.entry.Entry

public class Task
extends java.lang.Object
implements net.jini.core.entry.Entry

Base class for Entries that conform the task pattern. A worker will repeatedly take an object from the space, invoke its execute method, and post the result (response) back to the space.

See Also:
Serialized Form

Field Summary
 Identity id
           
 java.lang.Long submittedTime
           
 
Constructor Summary
Task()
           
Task(Identity id)
          Create new task with specified Identity.
 
Method Summary
 net.jini.core.entry.Entry execute()
          Execute whatever task the entry requires.
 net.jini.core.entry.Entry execute(java.util.Map map)
          Execute whatever task the entry requires.
 Identity getIdentity()
          Get the universally unique identifier for this task.
 java.lang.Long getMaxExecutionTime()
          After this time the task is aborted and returned to the space since the worker has either crashed, or hung, or whatever The default is for ten minutes.
 java.lang.Long getResponseLeaseTime()
          The lease time that will be requested for any response from execute.
 long getSubmittedTime()
          Get the submitted time
 void setIdentity(Identity id)
          Specify an universally unique identifier for the particular defined task.
 void setSubmittedTime(long time)
          Set the submitted time
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

public Identity id

submittedTime

public java.lang.Long submittedTime
Constructor Detail

Task

public Task()

Task

public Task(Identity id)
Create new task with specified Identity.

Method Detail

execute

public net.jini.core.entry.Entry execute()
Execute whatever task the entry requires. The semantics defined by this method imply that the results are returned to the space

Returns:
An Entry to write to the space
Throws:
java.lang.RuntimeException - if this method is not implemented

execute

public net.jini.core.entry.Entry execute(java.util.Map map)
Execute whatever task the entry requires. The semantics defined by this method imply that the results are returned to the space

Parameters:
map - - Used as a temporary cache such that Task entries may put and get attributes into the cache between one entry's use of execute and another of a related entry. Weak references are stored, so execute must be able to execute properly if the holder doesn't have a value for the key.
Returns:
An Entry to write to the space
Throws:
java.lang.RuntimeException - if this method is not implemented

getResponseLeaseTime

public java.lang.Long getResponseLeaseTime()
The lease time that will be requested for any response from execute. The default is for ten minutes.


getMaxExecutionTime

public java.lang.Long getMaxExecutionTime()
After this time the task is aborted and returned to the space since the worker has either crashed, or hung, or whatever The default is for ten minutes.


setIdentity

public void setIdentity(Identity id)
Specify an universally unique identifier for the particular defined task.

Parameters:
id - The Identity for th Task

getIdentity

public Identity getIdentity()
Get the universally unique identifier for this task.

Returns:
The universally unique identifier for this task.

getSubmittedTime

public long getSubmittedTime()
Get the submitted time

Returns:
The time (in milliseconds) this Task was submitted

setSubmittedTime

public void setSubmittedTime(long time)
Set the submitted time

Parameters:
time - The time (in milliseconds) this Task was submitted


Copyright (c) 2007 GigaSpaces Technologies, Inc.
All Rights Reserved.