1 package nmp.util; 2 3 /*** 4 * Represents a promise for which the result is already known 5 */ 6 public class FulfilledPromise 7 implements Promise 8 { 9 Object result; 10 11 public FulfilledPromise( Object result) { 12 this.result = result; 13 } 14 15 /*** 16 * Returns true if the result of invocation is already known 17 */ 18 public boolean isResultAvailable() { 19 return true; 20 } 21 22 /*** 23 * Gets the result of the preformed operation. This method blocks until the result 24 * is received. 25 */ 26 public Object getResult() { 27 return result; 28 } 29 30 /*** 31 * Waits (a given time) until the result of the operation is available. 32 * May throw the exception(error) "OperationNotAvailableException" if server could 33 * not be contacted 34 * @param mills The maximum time to wait in miliseconds. 0 - means waiting forever. 35 * @return Returns true if result ifavailable 36 */ 37 public boolean waitForResult( long mills) { 38 return true; 39 } 40 }

This page was automatically generated by Maven