Interface LdapPromise<S>

  • Type Parameters:
    S - The type of result returned by this promise.
    All Superinterfaces:
    Promise<S,​LdapException>

    public interface LdapPromise<S>
    extends Promise<S,​LdapException>
    A handle which can be used to retrieve the Result of an asynchronous Request.
    • Method Detail

      • getRequestId

        int getRequestId()
        Returns the request ID of the request if appropriate.
        Returns:
        The request ID, or -1 if there is no request ID.
      • thenOnResult

        LdapPromise<S> thenOnResult​(ResultHandler<? super S> onResult)
        Description copied from interface: Promise
        Registers the provided completion handler for notification once this Promise has completed with a result. If this Promise completes with an exception then the completion handler will not be notified.

        This method can be used for asynchronous completion notification and is equivalent to Promise.then(Function).

        Specified by:
        thenOnResult in interface Promise<S,​LdapException>
        Parameters:
        onResult - The completion handler which will be notified upon successful completion of this Promise.
        Returns:
        A Promise that is guaranteed to be completed once the provided callback has been executed.
      • thenOnException

        LdapPromise<S> thenOnException​(ExceptionHandler<? super LdapException> onException)
        Description copied from interface: Promise
        Registers the provided completion handler for notification if this Promise cannot be completed due to an exception. If this Promise completes with a result then the completion handler will not be notified.

        This method can be used for asynchronous completion notification.

        Specified by:
        thenOnException in interface Promise<S,​LdapException>
        Parameters:
        onException - The completion handler which will be notified upon failure completion of this Promise.
        Returns:
        A Promise that is guaranteed to be completed once the provided callback has been executed.
      • thenOnResultOrException

        LdapPromise<S> thenOnResultOrException​(Runnable onResultOrException)
        Description copied from interface: Promise
        Submits the provided runnable for execution once this Promise has completed, and regardless of whether it has a result or an exception.

        This method can be used for resource cleanup after a series of asynchronous tasks have completed. More specifically, this method should be used in a similar manner to finally statements in try...catch expressions.

        This method is equivalent to Promise.thenAlways(Runnable).

        Specified by:
        thenOnResultOrException in interface Promise<S,​LdapException>
        Parameters:
        onResultOrException - The runnable which will be notified regardless of the final outcome of this Promise.
        Returns:
        A Promise that is guaranteed to be completed once the provided callback has been executed.
      • then

        <VOUT> LdapPromise<VOUT> then​(Function<? super S,​VOUT,​LdapException> onResult)
        Description copied from interface: Promise
        Submits the provided function for execution once this Promise has completed with a result, and returns a new Promise representing the outcome of the function. If this Promise does not complete with a result then the function will not be invoked and the exception will be forwarded to the returned Promise.

        This method can be used for transforming the result of an asynchronous task.

        Specified by:
        then in interface Promise<S,​LdapException>
        Type Parameters:
        VOUT - The type of the function's result, or Void if the function does not return anything (i.e. it only has side-effects). Note that the type may be different to the type of this Promise.
        Parameters:
        onResult - The function which will be executed upon successful completion of this Promise.
        Returns:
        A new Promise representing the outcome of the function.
      • thenOnResultOrException

        LdapPromise<S> thenOnResultOrException​(ResultHandler<? super S> onResult,
                                               ExceptionHandler<? super LdapException> onException)
        Description copied from interface: Promise
        Registers the provided completion handlers for notification once this Promise has completed (with a result or an exception). If this Promise completes with a result then onResult will be notified with the result, otherwise onException will be notified with the exception that occurred.

        This method can be used for asynchronous completion notification.

        Specified by:
        thenOnResultOrException in interface Promise<S,​LdapException>
        Parameters:
        onResult - The completion handler which will be notified upon completion with a result of this Promise.
        onException - The completion handler which will be notified upon failure of this Promise.
        Returns:
        A Promise that is guaranted to be completed once the provided callback has been executed.
      • thenAlways

        LdapPromise<S> thenAlways​(Runnable onResultOrException)
        Description copied from interface: Promise
        Submits the provided runnable for execution once this Promise has completed, and regardless of whether it has a result or an exception.

        This method can be used for resource cleanup after a series of asynchronous tasks have completed. More specifically, this method should be used in a similar manner to finally statements in try...catch expressions.

        This method is equivalent to Promise.thenOnResultOrException(Runnable).

        Specified by:
        thenAlways in interface Promise<S,​LdapException>
        Parameters:
        onResultOrException - The runnable which will be notified regardless of the final outcome of this Promise.
        Returns:
        A Promise that is guaranteed to be completed once the provided callback has been executed.
      • thenFinally

        LdapPromise<S> thenFinally​(Runnable onResultOrException)
        Description copied from interface: Promise
        Submits the provided runnable for execution once this Promise has completed, and regardless of whether of its outcome.

        This method can be used for resource cleanup after a series of asynchronous tasks have completed. More specifically, this method should be used in a similar manner to finally statements in try...catch expressions.

        This method is equivalent to Promise.thenAlways(Runnable).

        Specified by:
        thenFinally in interface Promise<S,​LdapException>
        Parameters:
        onResultOrException - The runnable which will be notified regardless of the final outcome of this Promise.
        Returns:
        A Promise that is guaranteed to be completed once the provided callback has been executed.
      • thenAsync

        <VOUT> LdapPromise<VOUT> thenAsync​(AsyncFunction<? super S,​VOUT,​LdapException> onResult)
        Description copied from interface: Promise
        Submits the provided asynchronous function for execution once this Promise has completed with a result, and returns a new Promise representing the outcome of the function. If this Promise complete with an exception then the function will not be invoked and the error will be forwarded to the returned Promise.

        This method may be used for chaining together a series of asynchronous tasks.

        Specified by:
        thenAsync in interface Promise<S,​LdapException>
        Type Parameters:
        VOUT - The type of the function's result, or Void if the function does not return anything (i.e. it only has side-effects). Note that the type may be different to the type of this Promise.
        Parameters:
        onResult - The asynchronous function which will be executed upon successful completion of this Promise.
        Returns:
        A new Promise representing the outcome of the function.