Package org.forgerock.opendj.ldap.spi
Class LdapPromiseImpl<S>
java.lang.Object
org.forgerock.opendj.ldap.spi.LdapPromiseImpl<S>
- Type Parameters:
S- The type of result returned by this promise.
- All Implemented Interfaces:
Future<S>,LdapPromise<S>,LdapResultHandler<S>,org.forgerock.util.promise.ExceptionHandler<LdapException>,org.forgerock.util.promise.Promise<S,,LdapException> org.forgerock.util.promise.ResultHandler<S>
- Direct Known Subclasses:
ResultLdapPromiseImpl
This class provides an implementation of the
LdapPromise.- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLdapPromiseImpl(org.forgerock.util.promise.PromiseImpl<S, LdapException> wrappedPromise, int requestID) Creates a newLdapPromiseImplfrom a wrapped existingPromiseImpl. -
Method Summary
Modifier and TypeMethodDescriptionbooleancancel(boolean mayInterruptIfRunning) get()getOrThrow(long timeout, TimeUnit unit) getOrThrowUninterruptibly(long timeout, TimeUnit unit) intReturns the request ID of the request if appropriate.org.forgerock.util.promise.PromiseImpl<S, LdapException> voidhandleException(LdapException exception) Invoked when the asynchronous operation has failed.voidhandleResult(S result) Invoked when the asynchronous operation has completed successfully.booleanbooleanisDone()static <S> LdapPromiseImpl<S> Creates a newLdapPromiseImpl.static <S> LdapPromiseImpl<S> newLdapPromiseImpl(int requestID) Creates a newLdapPromiseImplwith a requestID.<VOUT,EOUT extends Exception>
org.forgerock.util.promise.Promise<VOUT, EOUT> then(org.forgerock.util.Function<? super S, 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 S, 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 S, VOUT, LdapException> onResult) thenAlways(Runnable onResultOrException) <VOUT,EOUT extends Exception>
org.forgerock.util.promise.Promise<VOUT, EOUT> thenAsync(org.forgerock.util.AsyncFunction<? super S, 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 S, 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 S, VOUT, LdapException> onResult) thenCatch(org.forgerock.util.Function<? super LdapException, S, EOUT> onException) thenCatchAsync(org.forgerock.util.AsyncFunction<? super LdapException, S, EOUT> onException) org.forgerock.util.promise.Promise<S, LdapException> thenCatchRuntimeException(org.forgerock.util.Function<? super RuntimeException, S, LdapException> onRuntimeException) org.forgerock.util.promise.Promise<S, LdapException> thenCatchRuntimeExceptionAsync(org.forgerock.util.AsyncFunction<? super RuntimeException, S, LdapException> onRuntimeException) thenFinally(Runnable onResultOrException) thenOnException(org.forgerock.util.promise.ExceptionHandler<? super LdapException> onException) thenOnResult(org.forgerock.util.promise.ResultHandler<? super S> onResult) thenOnResultOrException(Runnable onResultOrException) thenOnResultOrException(org.forgerock.util.promise.ResultHandler<? super S> onResult, org.forgerock.util.promise.ExceptionHandler<? super LdapException> onException) thenOnRuntimeException(org.forgerock.util.promise.RuntimeExceptionHandler onRuntimeException) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.forgerock.opendj.ldap.LdapPromise
getRequestID, then, thenAlways, thenAsync, thenFinally, thenOnException, thenOnResult, thenOnResultOrException, thenOnResultOrExceptionMethods 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
-
Constructor Details
-
LdapPromiseImpl
protected LdapPromiseImpl(org.forgerock.util.promise.PromiseImpl<S, LdapException> wrappedPromise, int requestID) Creates a newLdapPromiseImplfrom a wrapped existingPromiseImpl.- Parameters:
wrappedPromise- ThePromiseto wrap.requestID- Identifier of the request.
-
-
Method Details
-
newLdapPromiseImpl
Creates a newLdapPromiseImpl.- Type Parameters:
S- The type of result of the promise.- Returns:
- a new
LdapPromiseImpl
-
newLdapPromiseImpl
Creates a newLdapPromiseImplwith a requestID.- Type Parameters:
S- The type of result of the promise.- Parameters:
requestID- Identifier of the request.- Returns:
- a new
LdapPromiseImpl
-
handleException
Description copied from interface:LdapResultHandlerInvoked when the asynchronous operation has failed.- Specified by:
handleExceptionin interfaceorg.forgerock.util.promise.ExceptionHandler<S>- Specified by:
handleExceptionin interfaceLdapResultHandler<S>- Parameters:
exception- The error result exception indicating why the asynchronous operation has failed.
-
handleResult
Description copied from interface:LdapResultHandlerInvoked when the asynchronous operation has completed successfully.- Specified by:
handleResultin interfaceLdapResultHandler<S>- Specified by:
handleResultin interfaceorg.forgerock.util.promise.ResultHandler<S>- Parameters:
result- The result of the asynchronous operation.
-
getRequestID
public int getRequestID()Description copied from interface:LdapPromiseReturns the request ID of the request if appropriate.- Specified by:
getRequestIDin interfaceLdapPromise<R>- Returns:
- The request ID, or
-1if there is no request ID.
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) - Specified by:
cancelin interfaceFuture<R>- Specified by:
cancelin interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>>
-
get
- Specified by:
getin interfaceFuture<R>- Specified by:
getin interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>> - Throws:
ExecutionExceptionInterruptedException
-
get
public S get(long timeout, TimeUnit unit) throws ExecutionException, TimeoutException, InterruptedException - Specified by:
getin interfaceFuture<R>- Specified by:
getin interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>> - Throws:
ExecutionExceptionTimeoutExceptionInterruptedException
-
getOrThrow
- Specified by:
getOrThrowin interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>> - Throws:
InterruptedExceptionLdapException
-
getOrThrow
public S getOrThrow(long timeout, TimeUnit unit) throws InterruptedException, LdapException, TimeoutException - Specified by:
getOrThrowin interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>> - Throws:
InterruptedExceptionLdapExceptionTimeoutException
-
getOrThrowUninterruptibly
- Specified by:
getOrThrowUninterruptiblyin interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>> - Throws:
LdapException
-
getOrThrowUninterruptibly
public S getOrThrowUninterruptibly(long timeout, TimeUnit unit) throws LdapException, TimeoutException - Specified by:
getOrThrowUninterruptiblyin interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>> - Throws:
LdapExceptionTimeoutException
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceFuture<R>- Specified by:
isCancelledin interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>>
-
isDone
public boolean isDone()- Specified by:
isDonein interfaceFuture<R>- Specified by:
isDonein interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>>
-
thenOnException
public LdapPromise<S> thenOnException(org.forgerock.util.promise.ExceptionHandler<? super LdapException> onException) - Specified by:
thenOnExceptionin interfaceLdapPromise<R>- Specified by:
thenOnExceptionin interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>>
-
thenOnRuntimeException
public LdapPromise<S> thenOnRuntimeException(org.forgerock.util.promise.RuntimeExceptionHandler onRuntimeException) - Specified by:
thenOnRuntimeExceptionin interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>>
-
thenOnResult
- Specified by:
thenOnResultin interfaceLdapPromise<R>- Specified by:
thenOnResultin interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>>
-
thenOnResultOrException
- Specified by:
thenOnResultOrExceptionin interfaceLdapPromise<R>- Specified by:
thenOnResultOrExceptionin interfaceorg.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 S, VOUT, LdapException> onResult) - Specified by:
thenin interfaceLdapPromise<R>- Specified by:
thenin interfaceorg.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 S, VOUT, EOUT> onResult, org.forgerock.util.Function<? super LdapException, VOUT, EOUT> onException) - Specified by:
thenin interfaceorg.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 S, VOUT, EOUT> onResult, org.forgerock.util.Function<? super LdapException, VOUT, EOUT> onException, org.forgerock.util.Function<? super RuntimeException, VOUT, EOUT> onRuntimeException) - Specified by:
thenin interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>>
-
thenOnResultOrException
public LdapPromise<S> thenOnResultOrException(org.forgerock.util.promise.ResultHandler<? super S> onResult, org.forgerock.util.promise.ExceptionHandler<? super LdapException> onException) - Specified by:
thenOnResultOrExceptionin interfaceLdapPromise<R>- Specified by:
thenOnResultOrExceptionin interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>>
-
thenAlways
- Specified by:
thenAlwaysin interfaceLdapPromise<R>- Specified by:
thenAlwaysin interfaceorg.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 S, VOUT, LdapException> onResult) - Specified by:
thenAsyncin interfaceLdapPromise<R>- Specified by:
thenAsyncin interfaceorg.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 S, VOUT, EOUT> onResult, org.forgerock.util.AsyncFunction<? super LdapException, VOUT, EOUT> onException) - Specified by:
thenAsyncin interfaceorg.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 S, VOUT, EOUT> onResult, org.forgerock.util.AsyncFunction<? super LdapException, VOUT, EOUT> onException, org.forgerock.util.AsyncFunction<? super RuntimeException, VOUT, EOUT> onRuntimeException) - Specified by:
thenAsyncin interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>>
-
thenCatch
public <EOUT extends Exception> org.forgerock.util.promise.Promise<S,EOUT> thenCatch(org.forgerock.util.Function<? super LdapException, S, EOUT> onException) - Specified by:
thenCatchin interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>>
-
thenCatchRuntimeException
public org.forgerock.util.promise.Promise<S,LdapException> thenCatchRuntimeException(org.forgerock.util.Function<? super RuntimeException, S, LdapException> onRuntimeException) - Specified by:
thenCatchRuntimeExceptionin interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>>
-
thenCatchRuntimeExceptionAsync
public org.forgerock.util.promise.Promise<S,LdapException> thenCatchRuntimeExceptionAsync(org.forgerock.util.AsyncFunction<? super RuntimeException, S, LdapException> onRuntimeException) - Specified by:
thenCatchRuntimeExceptionAsyncin interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>>
-
thenFinally
- Specified by:
thenFinallyin interfaceLdapPromise<R>- Specified by:
thenFinallyin interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>>
-
thenCatchAsync
public <EOUT extends Exception> org.forgerock.util.promise.Promise<S,EOUT> thenCatchAsync(org.forgerock.util.AsyncFunction<? super LdapException, S, EOUT> onException) - Specified by:
thenCatchAsyncin interfaceorg.forgerock.util.promise.Promise<R,P extends org.forgerock.util.promise.Promise<R, LdapException>>
-
getWrappedPromise
-