Class ResultLdapPromiseImpl<R extends Request,​S extends Result>

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void adaptErrorResult​(Result result)
      Sets the result associated to this promise as an error result.
      boolean cancel​(boolean mayInterruptIfRunning)  
      boolean checkForTimeout()
      Returns true if this request should be canceled once the timeout period expires.
      R get()  
      R get​(long timeout, TimeUnit unit)  
      R getOrThrow()  
      R getOrThrow​(long timeout, TimeUnit unit)  
      R getOrThrowUninterruptibly()  
      R getOrThrowUninterruptibly​(long timeout, TimeUnit unit)  
      R getRequest()
      Returns the attached request.
      int getRequestID()
      Returns the request ID of the request if appropriate.
      long getTimestamp()
      Returns the creation time of this promise.
      P getWrappedPromise()  
      boolean handleIntermediateResponse​(IntermediateResponse response)
      Invoked each time an intermediate response is returned from the Directory Server.
      boolean isBindOrStartTLS()
      Returns true if this promise represents the result of a bind or StartTLS request.
      boolean isCancelled()  
      boolean isDone()  
      void setResultOrError​(S result)
      Sets the result associated to this promise.
      <VOUT,​EOUT extends Exception>
      org.forgerock.util.promise.Promise<VOUT,​EOUT>
      then​(org.forgerock.util.Function<? super R,​VOUT,​EOUT> onResult, org.forgerock.util.Function<? super LdapException,​VOUT,​EOUT> onException)  
      <VOUT,​EOUT extends Exception>
      org.forgerock.util.promise.Promise<VOUT,​EOUT>
      then​(org.forgerock.util.Function<? super R,​VOUT,​EOUT> onResult, org.forgerock.util.Function<? super LdapException,​VOUT,​EOUT> onException, org.forgerock.util.Function<? super RuntimeException,​VOUT,​EOUT> onRuntimeException)  
      <VOUT> LdapPromise<VOUT> then​(org.forgerock.util.Function<? super R,​VOUT,​LdapException> onResult)  
      LdapPromise<R> thenAlways​(Runnable onResultOrException)  
      <VOUT,​EOUT extends Exception>
      org.forgerock.util.promise.Promise<VOUT,​EOUT>
      thenAsync​(org.forgerock.util.AsyncFunction<? super R,​VOUT,​EOUT> onResult, org.forgerock.util.AsyncFunction<? super LdapException,​VOUT,​EOUT> onException)  
      <VOUT,​EOUT extends Exception>
      org.forgerock.util.promise.Promise<VOUT,​EOUT>
      thenAsync​(org.forgerock.util.AsyncFunction<? super R,​VOUT,​EOUT> onResult, org.forgerock.util.AsyncFunction<? super LdapException,​VOUT,​EOUT> onException, org.forgerock.util.AsyncFunction<? super RuntimeException,​VOUT,​EOUT> onRuntimeException)  
      <VOUT> LdapPromise<VOUT> thenAsync​(org.forgerock.util.AsyncFunction<? super R,​VOUT,​LdapException> onResult)  
      <EOUT extends Exception>
      org.forgerock.util.promise.Promise<R,​EOUT>
      thenCatch​(org.forgerock.util.Function<? super LdapException,​R,​EOUT> onException)  
      <EOUT extends Exception>
      org.forgerock.util.promise.Promise<R,​EOUT>
      thenCatchAsync​(org.forgerock.util.AsyncFunction<? super LdapException,​R,​EOUT> onException)  
      org.forgerock.util.promise.Promise<R,​LdapException> thenCatchRuntimeException​(org.forgerock.util.Function<? super RuntimeException,​R,​LdapException> onRuntimeException)  
      org.forgerock.util.promise.Promise<R,​LdapException> thenCatchRuntimeExceptionAsync​(org.forgerock.util.AsyncFunction<? super RuntimeException,​R,​LdapException> onRuntimeException)  
      LdapPromise<R> thenFinally​(Runnable onResultOrException)  
      LdapPromise<R> thenOnException​(org.forgerock.util.promise.ExceptionHandler<? super LdapException> onException)  
      LdapPromise<R> thenOnResult​(org.forgerock.util.promise.ResultHandler<? super R> onResult)  
      LdapPromise<R> thenOnResultOrException​(Runnable onResultOrException)  
      LdapPromise<R> thenOnResultOrException​(org.forgerock.util.promise.ResultHandler<? super R> onResult, org.forgerock.util.promise.ExceptionHandler<? super LdapException> onException)  
      LdapPromise<R> thenOnRuntimeException​(org.forgerock.util.promise.RuntimeExceptionHandler onRuntimeException)  
      String toString()
      Returns a string representation of this promise's state.
      • Methods inherited from interface org.forgerock.util.promise.Promise

        cancel, get, get, getOrThrow, getOrThrow, getOrThrowUninterruptibly, getOrThrowUninterruptibly, isCancelled, isDone, then, then, thenAsync, thenAsync, thenCatch, thenCatchAsync, thenCatchRuntimeException, thenCatchRuntimeExceptionAsync, thenOnRuntimeException
    • Method Detail

      • handleIntermediateResponse

        public final boolean handleIntermediateResponse​(IntermediateResponse response)
        Description copied from interface: IntermediateResponseHandler
        Invoked each time an intermediate response is returned from the Directory Server.
        Specified by:
        handleIntermediateResponse in interface IntermediateResponseHandler
        Parameters:
        response - The intermediate response.
        Returns:
        true if this handler should continue to be notified of any remaining intermediate responses, or false if the remaining responses should be skipped for some reason (e.g. a client side size limit has been reached).
      • isBindOrStartTLS

        public boolean isBindOrStartTLS()
        Returns true if this promise represents the result of a bind or StartTLS request. The default implementation is to return false.
        Returns:
        true if this promise represents the result of a bind or StartTLS request.
      • toString

        public String toString()
        Returns a string representation of this promise's state.
        Overrides:
        toString in class Object
        Returns:
        String representation of this promise's state.
      • adaptErrorResult

        public final void adaptErrorResult​(Result result)
        Sets the result associated to this promise as an error result.
        Parameters:
        result - result of an operation
      • getTimestamp

        public final long getTimestamp()
        Returns the creation time of this promise.
        Returns:
        the timestamp indicating creation time of this promise
      • setResultOrError

        public final void setResultOrError​(S result)
        Sets the result associated to this promise.
        Parameters:
        result - the result of operation
      • getRequest

        public R getRequest()
        Returns the attached request.
        Returns:
        The request.
      • checkForTimeout

        public boolean checkForTimeout()
        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.
        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>>
      • getOrThrowUninterruptibly

        public R 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
      • 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<R> 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<R> 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<R> thenOnResult​(org.forgerock.util.promise.ResultHandler<? super R> 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<R> 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 R,​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 R,​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 R,​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<R> thenOnResultOrException​(org.forgerock.util.promise.ResultHandler<? super R> 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<R> 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 R,​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 R,​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 R,​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<R,​EOUT> thenCatch​(org.forgerock.util.Function<? super LdapException,​R,​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<R,​LdapException> thenCatchRuntimeException​(org.forgerock.util.Function<? super RuntimeException,​R,​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<R,​LdapException> thenCatchRuntimeExceptionAsync​(org.forgerock.util.AsyncFunction<? super RuntimeException,​R,​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<R> 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<R,​EOUT> thenCatchAsync​(org.forgerock.util.AsyncFunction<? super LdapException,​R,​EOUT> onException)
        Specified by:
        thenCatchAsync in interface org.forgerock.util.promise.Promise<R,​P extends org.forgerock.util.promise.Promise<R,​LdapException>>
      • getWrappedPromise

        public P getWrappedPromise()