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 Object
implements OortObject.Result<D>

Implementation of OortObject.Result that allows applications to block, waiting for the result, via get(long, TimeUnit).

  • Constructor Details

  • Method Details

    • onResult

      public void onResult​(D result)
      Description copied from interface: OortObject.Result

      Callback method invoked when the result is available.

      Specified by:
      onResult in interface OortObject.Result<D>
      Parameters:
      result - the result object
    • get

      public D get​(long time, TimeUnit unit) throws InterruptedException, TimeoutException

      Waits for the result to be available for the specified amount of time.

      If the wait time elapses, a TimeoutException is thrown, but this method can be called again to wait more time for the result.

      Parameters:
      time - the maximum time to wait
      unit - the time unit
      Returns:
      the result if available, otherwise an exception is thrown
      Throws:
      InterruptedException - if the thread is interrupted while waiting
      TimeoutException - if the time elapses before the result is available