|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.tuplespace.simple.SimpleTupleSpace
Implements an unbounded TupleSpace.
Objects can be added until memory is exhausted. The space is
implemented as a LinkedList.
This implementation does not guarantee object liveliness or content. You should use external synchronization if this might be a problem.
| Field Summary | |
protected org.apache.commons.logging.Log |
logger
|
| Constructor Summary | |
SimpleTupleSpace()
|
|
| Method Summary | |
void |
addToSpace(Tuple tuple)
Adds tuple to the space. |
static void |
checkTemplate(Template template)
Assert that the Template is non-null. |
static void |
checkTuple(Tuple tuple)
Assert that the Tuple is non-null. |
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.
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected final org.apache.commons.logging.Log logger
| Constructor Detail |
public SimpleTupleSpace()
| Method Detail |
public void addToSpace(Tuple tuple)
TupleSpaceWhen 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.
addToSpace in interface TupleSpacetuple - The tuple being offered to other objects.
public Tuple readAndRemove(Template template)
throws InterruptedWhileWaitingException
TupleSpaceTuple matching Template is available.
readAndRemove in interface TupleSpacetemplate - A template, describing what the caller would like to
retrieve from the space.
InterruptedWhileWaitingException - When an
InterruptedException is thrown while
waiting.
public Tuple readAndRemoveWithTimeout(Template template,
long timeout)
throws InterruptedWhileWaitingException
TupleSpaceTuple 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.
readAndRemoveWithTimeout in interface TupleSpacetemplate - 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.TupleSpace.readAndRemove(net.sf.tuplespace.Template)public static final void checkTuple(Tuple tuple)
Tuple is non-null.
tuple - The tuple to check.
IllegalArgumentException - If tuple is
null.public static final void checkTemplate(Template template)
Template is non-null.
template - The template to check.
IllegalArgumentException - If template is
null.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||