com.sun.jini.example.ray.ex1.genericWorker
Class TaskEntry

java.lang.Object
  extended bycom.sun.jini.example.ray.ex1.genericWorker.TaskEntry
All Implemented Interfaces:
net.jini.core.entry.Entry, java.io.Serializable
Direct Known Subclasses:
RenderTask

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

Parent class for generic tasks. A worker thread will repeatedly take a TaskEntry object from the space, invoke its execute method, and write the returned Entry into the space with the lease time returned by responseLeaseTime. If execute returns null, no value will be written -- it is assumed that a null return value means that the task requires no response in the space.

See Also:
Serialized Form

Constructor Summary
TaskEntry()
           
 
Method Summary
 net.jini.core.entry.Entry execute(com.sun.jini.collection.WeakTable cache)
          Execute whatever task the entry requires.
 long responseLeaseTime()
          The lease time that will be requested for any response from execute.
 void verbose(boolean showMessages)
          Turn on verbose messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskEntry

public TaskEntry()
Method Detail

execute

public net.jini.core.entry.Entry execute(com.sun.jini.collection.WeakTable cache)
Execute whatever task the entry requires. If an entry is returned, it is written back into the space. If null is returned, nothing is written into the space. If a subclass of TaskEntry has not overridden this method, a RuntimeException will be generated when execute is invoked.

The WeakTable entry can be used to store cached state 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.


responseLeaseTime

public long responseLeaseTime()
The lease time that will be requested for any response from execute. The default is for ten minutes.


verbose

public void verbose(boolean showMessages)
Turn on verbose messages. What that means is up to each task type -- by default this method does nothing.



Copyright © 2003 Sun Microsystems, Inc. All Rights Reserved.