Package org.cometd.oort
Class OortObject.Result.Deferred<D>
- java.lang.Object
-
- org.cometd.oort.OortObject.Result.Deferred<D>
-
- Type Parameters:
D- the result type
- All Implemented Interfaces:
OortObject.Result<D>
- Enclosing interface:
- OortObject.Result<R>
public static class OortObject.Result.Deferred<D> extends java.lang.Object implements OortObject.Result<D>
Implementation of
OortObject.Resultthat allows applications to block, waiting for the result, viaget(long, TimeUnit).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.cometd.oort.OortObject.Result
OortObject.Result.Deferred<D>
-
-
Constructor Summary
Constructors Constructor Description Deferred()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Dget(long time, java.util.concurrent.TimeUnit unit)Waits for the result to be available for the specified amount of time.voidonResult(D result)Callback method invoked when the result is available.
-
-
-
Method Detail
-
onResult
public void onResult(D result)
Description copied from interface:OortObject.ResultCallback method invoked when the result is available.
- Specified by:
onResultin interfaceOortObject.Result<D>- Parameters:
result- the result object
-
get
public D get(long time, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException
Waits for the result to be available for the specified amount of time.
If the wait time elapses, a
TimeoutExceptionis thrown, but this method can be called again to wait more time for the result.- Parameters:
time- the maximum time to waitunit- the time unit- Returns:
- the result if available, otherwise an exception is thrown
- Throws:
java.lang.InterruptedException- if the thread is interrupted while waitingjava.util.concurrent.TimeoutException- if the time elapses before the result is available
-
-