| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Describes a tuple space.
Tuple spaces are areas where multiple objects can be deposited, and retrieved from some time later. It does not matter who puts a tuple, and who retrieves a tuple from the space. The provider and retriever might be different objects, in different threads, in different JVMs. It does not matter.
Objects wanting to put an object in the space should simply call
 addToSpace(net.sf.tuplespace.Tuple).  This method will not block,
 allowing the caller to continue it's work.
Objects wanting to retrieve information from the space should instead
 call readAndRemove(net.sf.tuplespace.Template).  The Template
 will be used to find matching tuples in the space.  When a tuple is found
 that matches, readAndRemove(net.sf.tuplespace.Template) will return,
 with the found tuple.
Implementors must guarantee atomicity—which means that a tuple can be offered only once, and that a tuple can only be retrieved once.
| Method Summary | |
 void | 
addToSpace(Tuple tuple)
Adds tuple to the space.  | 
 Tuple | 
readAndRemove(Template template)
Blocks until a Tuple matching Template is available. | 
 Tuple | 
readAndRemoveWithTimeout(Template template,
                         long timeout)
Blocks for a maximum of timeout milliseconds, until a Tuple matching Template is available.
  | 
| Method Detail | 
public Tuple readAndRemove(Template template)
                    throws InterruptedWhileWaitingException
Tuple matching Template is available.
template - A template, describing what the caller would like to
                 retrieve from the space.
InterruptedWhileWaitingException - When an
                                  InterruptedException is thrown while
                                  waiting.
IllegalArgumentException - When template is
                                  null.
public Tuple readAndRemoveWithTimeout(Template template,
                                      long timeout)
                               throws InterruptedWhileWaitingException,
                                      IllegalArgumentException
Tuple matching Template is available.
 If timeout is lower than or equal to zero, the method
 will not block, and will immediately return the tuple, or
 null.
Since Java's time resolution is poor, the actual timeout might be different. Implementors should guarantee a minimum timeout at least equal to timeout, but might not be able to guarantee the actual maximum time.
template - A template, describing what the caller would like to
                 retrieve from the space.timeout - The maximum number of milliseconds to block.
null if
         none could be found before the timeout was reached.
InterruptedWhileWaitingException - When an
                                  InterruptedException is thrown while
                                  waiting.
IllegalArgumentException - When template is
                                  null.readAndRemove(net.sf.tuplespace.Template)
public void addToSpace(Tuple tuple)
                throws IllegalArgumentException
When this method returns, the tuple will have been made available to
 other objects waiting for a Template matching this tuple.
This method does not block.
tuple - The tuple being offered to other objects.
IllegalArgumentException - When tuple is
                                  null.
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||