Package org.qiunet.utils.async.future
Class DCompletePromise<V>
java.lang.Object
java.util.concurrent.CompletableFuture<V>
org.qiunet.utils.async.future.DCompletePromise<V>
- All Implemented Interfaces:
CompletionStage<V>,Future<V>,DFuture<V>,DPromise<V>
public class DCompletePromise<V>
extends CompletableFuture<V>
implements DFuture<V>, DPromise<V>, CompletionStage<V>
- Author:
- qiunet 2020/3/8 22:01
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.CompletableFuture
CompletableFuture.AsynchronousCompletionTask -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionawait()Waits for this future to be completed.booleanawait(long timeoutMillis) Waits for this future to be completed within the specified time limit.booleanWaits for this future to be completed within the specified time limit.Waits for this future to be completed without interruption.booleanawaitUninterruptibly(long timeoutMillis) Waits for this future to be completed within the specified time limit without interruption.booleanawaitUninterruptibly(long timeout, TimeUnit unit) Waits for this future to be completed within the specified time limit without interruption.booleancancel(boolean mayInterruptIfRunning) booleanbooleanboolean是否成功.voidbooleantryFailure(Throwable cause) 尝试设置失败 与DPromise.trySuccess(Object)相斥booleantrySuccess(V result) 尝试设置成功 与DPromise.tryFailure(Throwable)相斥Methods inherited from class java.util.concurrent.CompletableFuture
acceptEither, acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEither, applyToEitherAsync, applyToEitherAsync, completeAsync, completeAsync, completedFuture, completedStage, completeExceptionally, completeOnTimeout, copy, defaultExecutor, delayedExecutor, delayedExecutor, exceptionally, exceptionallyAsync, exceptionallyAsync, exceptionallyCompose, exceptionallyComposeAsync, exceptionallyComposeAsync, failedFuture, failedStage, get, get, getNow, getNumberOfDependents, handle, handleAsync, handleAsync, isCompletedExceptionally, isDone, join, minimalCompletionStage, newIncompleteFuture, obtrudeException, obtrudeValue, orTimeout, 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, whenCompleteAsyncMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.CompletionStage
acceptEither, acceptEitherAsync, acceptEitherAsync, applyToEither, applyToEitherAsync, applyToEitherAsync, exceptionally, exceptionallyAsync, exceptionallyAsync, exceptionallyCompose, exceptionallyComposeAsync, exceptionallyComposeAsync, handle, handleAsync, handleAsync, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, whenComplete, whenCompleteAsync, whenCompleteAsyncMethods inherited from interface org.qiunet.utils.async.future.DFuture
whenComplete
-
Constructor Details
-
DCompletePromise
public DCompletePromise()
-
-
Method Details
-
setFuture
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceFuture<V>- Overrides:
isCancelledin classCompletableFuture<V>
-
isSuccess
public boolean isSuccess()Description copied from interface:DFuture是否成功. -
trySuccess
Description copied from interface:DPromise尝试设置成功 与DPromise.tryFailure(Throwable)相斥- Specified by:
trySuccessin interfaceDPromise<V>- Returns:
-
tryFailure
Description copied from interface:DPromise尝试设置失败 与DPromise.trySuccess(Object)相斥- Specified by:
tryFailurein interfaceDPromise<V>- Returns:
-
complete
- Overrides:
completein classCompletableFuture<V>
-
await
Description copied from interface:DFutureWaits for this future to be completed. -
awaitUninterruptibly
Description copied from interface:DFutureWaits for this future to be completed without interruption. This method catches anInterruptedExceptionand discards it silently.- Specified by:
awaitUninterruptiblyin interfaceDFuture<V>- Specified by:
awaitUninterruptiblyin interfaceDPromise<V>
-
await
Description copied from interface:DFutureWaits for this future to be completed within the specified time limit.- Specified by:
awaitin interfaceDFuture<V>- Returns:
trueif and only if the future was completed within the specified time limit- Throws:
InterruptedException- if the current thread was interrupted
-
await
Description copied from interface:DFutureWaits for this future to be completed within the specified time limit.- Specified by:
awaitin interfaceDFuture<V>- Returns:
trueif and only if the future was completed within the specified time limit- Throws:
InterruptedException- if the current thread was interrupted
-
awaitUninterruptibly
Description copied from interface:DFutureWaits for this future to be completed within the specified time limit without interruption. This method catches anInterruptedExceptionand discards it silently.- Specified by:
awaitUninterruptiblyin interfaceDFuture<V>- Returns:
trueif and only if the future was completed within the specified time limit
-
awaitUninterruptibly
public boolean awaitUninterruptibly(long timeoutMillis) Description copied from interface:DFutureWaits for this future to be completed within the specified time limit without interruption. This method catches anInterruptedExceptionand discards it silently.- Specified by:
awaitUninterruptiblyin interfaceDFuture<V>- Returns:
trueif and only if the future was completed within the specified time limit
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
-