|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.Continuation.MultiContinuation
public static class Continuation.MultiContinuation
This class represents a Continuation which is used when multiple results are expected, which can come back at different times. The prototypical example of its use is in an application like Past, where Insert messages are sent to a number of replicas and the responses come back at different times. Optionally, the creator can override the isDone() method, which is called each time an intermediate result comes in. This allows applications like Past to declare an insert successful after a certain number of results have come back successful.
Field Summary | |
---|---|
protected boolean |
done
|
protected boolean[] |
haveResult
|
protected Continuation |
parent
|
protected java.lang.Object[] |
result
|
Constructor Summary | |
---|---|
Continuation.MultiContinuation(Continuation parent,
int num)
Constructor which takes a parent continuation as well as the number of results which to expect. |
Method Summary | |
---|---|
java.lang.Object |
getResult()
Method which can also be overridden to change what result should be returned to the parent continuation. |
Continuation |
getSubContinuation(int index)
Returns the continuation which should be used as the result continuation for the index-th result. |
boolean |
isDone()
Method which returns whether or not we are done. |
protected void |
receive(int index,
java.lang.Object o)
Internal method which receives the results and determines if we are done with this task. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.Object[] result
protected boolean[] haveResult
protected Continuation parent
protected boolean done
Constructor Detail |
---|
public Continuation.MultiContinuation(Continuation parent, int num)
parent
- The parent continuationnum
- The number of results expected to come inMethod Detail |
---|
public Continuation getSubContinuation(int index)
The
- index of this continuationprotected void receive(int index, java.lang.Object o)
index
- The index the result is foro
- The result for that continuationpublic boolean isDone() throws java.lang.Exception
java.lang.Exception
public java.lang.Object getResult()
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |