Class SearchResultLdapPromiseImpl

All Implemented Interfaces:
Future<Result>, IntermediateResponseHandler, LdapPromise<Result>, LdapResultHandler<Result>, SearchResultHandler, org.forgerock.util.promise.ExceptionHandler<LdapException>, org.forgerock.util.promise.Promise<Result,LdapException>, org.forgerock.util.promise.ResultHandler<Result>

Search result promise implementation.
  • Method Details

    • handleEntry

      public boolean handleEntry(SearchResultEntry entry)
      Description copied from interface: SearchResultHandler
      Invoked each time a search result entry is returned from an asynchronous search operation.
      Specified by:
      handleEntry in interface SearchResultHandler
      Parameters:
      entry - The search result entry.
      Returns:
      true if this handler should continue to be notified of any remaining entries and references, or false if the remaining entries and references should be skipped for some reason (e.g. a client side size limit has been reached).
    • handleReference

      public boolean handleReference(SearchResultReference reference)
      Description copied from interface: SearchResultHandler
      Invoked each time a search result reference is returned from an asynchronous search operation.
      Specified by:
      handleReference in interface SearchResultHandler
      Parameters:
      reference - The search result reference.
      Returns:
      true if this handler should continue to be notified of any remaining entries and references, or false if the remaining entries and references should be skipped for some reason (e.g. a client side size limit has been reached).
    • checkForTimeout

      public boolean checkForTimeout()
      Description copied from class: ResultLdapPromiseImpl
      Returns true if this request should be canceled once the timeout period expires. The default implementation is to return true which will be appropriate for nearly all requests, the one obvious exception being persistent searches.
      Overrides:
      checkForTimeout in class ResultLdapPromiseImpl<SearchRequest,Result>
      Returns:
      true if this request should be canceled once the timeout period expires.
    • getRequestID

      public int getRequestID()
      Description copied from interface: LdapPromise
      Returns the request ID of the request if appropriate.
      Specified by:
      getRequestID in interface LdapPromise<R>
      Returns:
      The request ID, or -1 if there is no request ID.
    • cancel

      public boolean cancel(boolean mayInterruptIfRunning)
      Specified by:
      cancel in interface Future<R>
      Specified by:
      cancel in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • get

      Specified by:
      get in interface Future<R>
      Specified by:
      get in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
      Throws:
      ExecutionException
      InterruptedException
    • get

      public Result get(long timeout, TimeUnit unit) throws ExecutionException, TimeoutException, InterruptedException
      Specified by:
      get in interface Future<R>
      Specified by:
      get in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
      Throws:
      ExecutionException
      TimeoutException
      InterruptedException
    • getOrThrow

      public Result getOrThrow() throws InterruptedException, LdapException
      Specified by:
      getOrThrow in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
      Throws:
      InterruptedException
      LdapException
    • getOrThrow

      public Result getOrThrow(long timeout, TimeUnit unit) throws InterruptedException, LdapException, TimeoutException
      Specified by:
      getOrThrow in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
      Throws:
      InterruptedException
      LdapException
      TimeoutException
    • getOrThrowUninterruptibly

      public Result getOrThrowUninterruptibly() throws LdapException
      Specified by:
      getOrThrowUninterruptibly in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
      Throws:
      LdapException
    • getOrThrowUninterruptibly

      public Result getOrThrowUninterruptibly(long timeout, TimeUnit unit) throws LdapException, TimeoutException
      Specified by:
      getOrThrowUninterruptibly in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
      Throws:
      LdapException
      TimeoutException
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface Future<R>
      Specified by:
      isCancelled in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • isDone

      public boolean isDone()
      Specified by:
      isDone in interface Future<R>
      Specified by:
      isDone in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • thenOnException

      public LdapPromise<Result> thenOnException(org.forgerock.util.promise.ExceptionHandler<? super LdapException> onException)
      Specified by:
      thenOnException in interface LdapPromise<R>
      Specified by:
      thenOnException in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • thenOnRuntimeException

      public LdapPromise<Result> thenOnRuntimeException(org.forgerock.util.promise.RuntimeExceptionHandler onRuntimeException)
      Specified by:
      thenOnRuntimeException in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • thenOnResult

      public LdapPromise<Result> thenOnResult(org.forgerock.util.promise.ResultHandler<? super Result> onResult)
      Specified by:
      thenOnResult in interface LdapPromise<R>
      Specified by:
      thenOnResult in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • thenOnResultOrException

      public LdapPromise<Result> thenOnResultOrException(Runnable onResultOrException)
      Specified by:
      thenOnResultOrException in interface LdapPromise<R>
      Specified by:
      thenOnResultOrException in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • then

      public <VOUT> LdapPromise<VOUT> then(org.forgerock.util.Function<? super Result,VOUT,LdapException> onResult)
      Specified by:
      then in interface LdapPromise<R>
      Specified by:
      then in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • then

      public <VOUT, EOUT extends Exception> org.forgerock.util.promise.Promise<VOUT,EOUT> then(org.forgerock.util.Function<? super Result,VOUT,EOUT> onResult, org.forgerock.util.Function<? super LdapException,VOUT,EOUT> onException)
      Specified by:
      then in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • then

      public <VOUT, EOUT extends Exception> org.forgerock.util.promise.Promise<VOUT,EOUT> then(org.forgerock.util.Function<? super Result,VOUT,EOUT> onResult, org.forgerock.util.Function<? super LdapException,VOUT,EOUT> onException, org.forgerock.util.Function<? super RuntimeException,VOUT,EOUT> onRuntimeException)
      Specified by:
      then in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • thenOnResultOrException

      public LdapPromise<Result> thenOnResultOrException(org.forgerock.util.promise.ResultHandler<? super Result> onResult, org.forgerock.util.promise.ExceptionHandler<? super LdapException> onException)
      Specified by:
      thenOnResultOrException in interface LdapPromise<R>
      Specified by:
      thenOnResultOrException in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • thenAlways

      public LdapPromise<Result> thenAlways(Runnable onResultOrException)
      Specified by:
      thenAlways in interface LdapPromise<R>
      Specified by:
      thenAlways in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • thenAsync

      public <VOUT> LdapPromise<VOUT> thenAsync(org.forgerock.util.AsyncFunction<? super Result,VOUT,LdapException> onResult)
      Specified by:
      thenAsync in interface LdapPromise<R>
      Specified by:
      thenAsync in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • thenAsync

      public <VOUT, EOUT extends Exception> org.forgerock.util.promise.Promise<VOUT,EOUT> thenAsync(org.forgerock.util.AsyncFunction<? super Result,VOUT,EOUT> onResult, org.forgerock.util.AsyncFunction<? super LdapException,VOUT,EOUT> onException)
      Specified by:
      thenAsync in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • thenAsync

      public <VOUT, EOUT extends Exception> org.forgerock.util.promise.Promise<VOUT,EOUT> thenAsync(org.forgerock.util.AsyncFunction<? super Result,VOUT,EOUT> onResult, org.forgerock.util.AsyncFunction<? super LdapException,VOUT,EOUT> onException, org.forgerock.util.AsyncFunction<? super RuntimeException,VOUT,EOUT> onRuntimeException)
      Specified by:
      thenAsync in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • thenCatch

      public <EOUT extends Exception> org.forgerock.util.promise.Promise<Result,EOUT> thenCatch(org.forgerock.util.Function<? super LdapException,Result,EOUT> onException)
      Specified by:
      thenCatch in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • thenCatchRuntimeException

      public org.forgerock.util.promise.Promise<Result,LdapException> thenCatchRuntimeException(org.forgerock.util.Function<? super RuntimeException,Result,LdapException> onRuntimeException)
      Specified by:
      thenCatchRuntimeException in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • thenCatchRuntimeExceptionAsync

      public org.forgerock.util.promise.Promise<Result,LdapException> thenCatchRuntimeExceptionAsync(org.forgerock.util.AsyncFunction<? super RuntimeException,Result,LdapException> onRuntimeException)
      Specified by:
      thenCatchRuntimeExceptionAsync in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • thenFinally

      public LdapPromise<Result> thenFinally(Runnable onResultOrException)
      Specified by:
      thenFinally in interface LdapPromise<R>
      Specified by:
      thenFinally in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • thenCatchAsync

      public <EOUT extends Exception> org.forgerock.util.promise.Promise<Result,EOUT> thenCatchAsync(org.forgerock.util.AsyncFunction<? super LdapException,Result,EOUT> onException)
      Specified by:
      thenCatchAsync in interface org.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R,LdapException>>
    • getWrappedPromise

      public org.forgerock.util.promise.PromiseImpl<Result,LdapException> getWrappedPromise()