View Javadoc

1   package org.xvsm.lookup.freepastry;
2   
3   import rice.Continuation;
4   
5   /***
6    * This class is the class, which receiveResult funtion is called, when a
7    * publish function is performed successfully
8    * 
9    * @author Hannu-Daniel Goiss
10   */
11  public class PublishContinuation implements Continuation {
12  	private boolean finished = false;
13  	private Exception exception = null;
14  
15  	/* (non-Javadoc)
16  	 * @see rice.Continuation#receiveResult(java.lang.Object)
17  	 */
18  	public void receiveResult(Object result) {          
19  		Boolean[] results = ((Boolean[]) result);
20  		int numSuccessfulStores = 0;
21  		for (int ctr = 0; ctr < results.length; ctr++) {
22  			if (results[ctr].booleanValue()) 
23  				numSuccessfulStores++;
24  		}
25  		
26  		finished = true;
27  	}
28  
29  	/* (non-Javadoc)
30  	 * @see rice.Continuation#receiveException(java.lang.Exception)
31  	 */
32  	public void receiveException(Exception result) {
33  		exception = result;
34  		finished = true;
35  	}
36  
37  	/***
38  	 * @return the finished
39  	 */
40  	public boolean isFinished() {
41  		return finished;
42  	}
43  
44  	/***
45  	 * @return the exception
46  	 */
47  	public Exception getException() {
48  		return exception;
49  	}
50  }