public final class UnmodifiableFuture<T> extends EventLoopCheckingFuture<T>
CompletableFuture which prevents the caller from completing it. An attempt to call any of
the following methods will trigger an UnsupportedOperationException:
Also, cancel(boolean) will do nothing but returning whether cancelled or not.CompletableFuture.AsynchronousCompletionTask| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel(boolean mayInterruptIfRunning)
Does nothing but returning whether this future has been cancelled or not.
|
boolean |
complete(T value)
Throws an
UnsupportedOperationException. |
static <U> UnmodifiableFuture<U> |
completedFuture(U value)
Returns an
UnmodifiableFuture which has been completed with the specified value. |
boolean |
completeExceptionally(Throwable ex)
Throws an
UnsupportedOperationException. |
static <U> UnmodifiableFuture<U> |
exceptionallyCompletedFuture(Throwable cause)
Returns an
UnmodifiableFuture which has been completed exceptionally with the specified
Throwable. |
void |
obtrudeException(Throwable ex)
Throws an
UnsupportedOperationException. |
void |
obtrudeValue(T value)
Throws an
UnsupportedOperationException. |
static <U> UnmodifiableFuture<U> |
wrap(CompletableFuture<U> future)
Returns an
UnmodifiableFuture which will be completed when the specified
CompletableFuture is completed. |
get, get, joinacceptEither, acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEither, applyToEitherAsync, applyToEitherAsync, exceptionally, getNow, getNumberOfDependents, handle, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, runAsync, runAsync, supplyAsync, supplyAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, toString, whenComplete, whenCompleteAsync, whenCompleteAsyncpublic static <U> UnmodifiableFuture<U> completedFuture(U value)
UnmodifiableFuture which has been completed with the specified value.public static <U> UnmodifiableFuture<U> exceptionallyCompletedFuture(Throwable cause)
UnmodifiableFuture which has been completed exceptionally with the specified
Throwable.public static <U> UnmodifiableFuture<U> wrap(CompletableFuture<U> future)
UnmodifiableFuture which will be completed when the specified
CompletableFuture is completed.public boolean complete(T value)
UnsupportedOperationException.complete in class CompletableFuture<T>public boolean completeExceptionally(Throwable ex)
UnsupportedOperationException.completeExceptionally in class CompletableFuture<T>public boolean cancel(boolean mayInterruptIfRunning)
public void obtrudeValue(T value)
UnsupportedOperationException.obtrudeValue in class CompletableFuture<T>public void obtrudeException(Throwable ex)
UnsupportedOperationException.obtrudeException in class CompletableFuture<T>Copyright © 2020 LeanCloud. All rights reserved.