java.lang.Object
cn.wjybxx.concurrent.ForwardFuture<T>
cn.wjybxx.concurrent.ReadOnlyFuture<T>
- 所有已实现的接口:
ICompletionStage<T>,IFuture<T>,Future<T>
为
IPromise提供只读视图- 作者:
- wjybxx date - 2024/1/9
-
嵌套类概要
从接口继承的嵌套类/接口 java.util.concurrent.Future
Future.State -
字段概要
从类继承的字段 cn.wjybxx.concurrent.ForwardFuture
future -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明返回只读的Future视图, 如果Future是一个提供了写接口的Promise,则返回一个只读的Future视图,返回的实例会在当前Promise进入完成状态时进入完成状态。booleancancel(boolean mayInterruptIfRunning) 从类继承的方法 cn.wjybxx.concurrent.ForwardFuture
await, await, awaitUninterruptibly, awaitUninterruptibly, catching, catching, catchingAsync, catchingAsync, composeApply, composeApply, composeApplyAsync, composeApplyAsync, composeCall, composeCall, composeCallAsync, composeCallAsync, composeCatching, composeCatching, composeCatchingAsync, composeCatchingAsync, composeHandle, composeHandle, composeHandleAsync, composeHandleAsync, exceptionNow, exceptionNow, executor, get, get, getNow, getNow, handle, handle, handleAsync, handleAsync, isCancelled, isComputing, isDone, isFailed, isFailedOrCancelled, isPending, isSucceeded, join, onCompleted, onCompleted, onCompleted, onCompleted, onCompletedAsync, onCompletedAsync, onCompletedAsync, onCompletedAsync, resultNow, state, status, thenAccept, thenAccept, thenAcceptAsync, thenAcceptAsync, thenApply, thenApply, thenApplyAsync, thenApplyAsync, thenCall, thenCall, thenCallAsync, thenCallAsync, thenRun, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, toFuture, whenComplete, whenComplete, whenCompleteAsync, whenCompleteAsync
-
构造器详细资料
-
ReadOnlyFuture
- 参数:
promise- 使用future类型可避免更具体的依赖
-
-
方法详细资料
-
asReadonly
从接口复制的说明:IFuture返回只读的Future视图, 如果Future是一个提供了写接口的Promise,则返回一个只读的Future视图,返回的实例会在当前Promise进入完成状态时进入完成状态。1. 一般情况下我们通过接口隔离即可达到读写分离目的,这可以节省开销;在大规模链式调用的情况下,Promise继承Future很有效。 2. 但如果觉得返回Promise实例给任务的发起者不够安全,可创建Promise的只读视图返回给用户 3. 这里不要求返回的必须是同一个实例,每次都可以创建一个新的实例。
- 指定者:
asReadonly在接口中IFuture<T>- 覆盖:
asReadonly在类中ForwardFuture<T>
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) 从接口复制的说明:IFuture
-