接口的使用
cn.wjybxx.concurrent.ICancelToken
使用ICancelToken的程序包
-
cn.wjybxx.concurrent中ICancelToken的使用
修饰符和类型类说明final class取消令牌源由任务的创建者(发起者)持有,具备取消权限。final class声明为ICancelToken的cn.wjybxx.concurrent中的字段修饰符和类型方法说明CancelTokenSource.asReadonly()ICancelToken.asReadonly()返回一个只读的ICancelToken试图,返回的实例会在当前Token被取消时取消。ReadonlyCancelToken.asReadonly()Context.cancelToken()IContext.cancelToken()任务绑定的取消令牌(取消上下文) 1.每个任务可有独立的取消信号 -- 私有属性。MiniContext.cancelToken()参数类型为ICancelToken的cn.wjybxx.concurrent中的方法修饰符和类型方法说明Context.childWith(Object state, ICancelToken cancelToken, T blackboard, Object sharedProps) Context.childWithState(Object state, ICancelToken cancelToken) Context.newContext(Context<T> parent, Object state, ICancelToken cancelToken, T blackboard, Object sharedProps) 用于子类重写static <U> Context<U> Context.ofCancelToken(ICancelToken cancelToken) static MiniContextMiniContext.ofCancelToken(ICancelToken cancelToken) static <U> Context<U> Context.ofState(Object state, ICancelToken cancelToken) static <U> Context<U> Context.ofState(Object state, ICancelToken cancelToken, U blackboard, Object sharedProps) static MiniContextMiniContext.ofState(Object state, ICancelToken cancelToken) voidCancelTokenListener.onCancelRequested(ICancelToken cancelToken) voidScheduledPromiseTask.onCancelRequested(ICancelToken cancelToken) Context.with(Object state, ICancelToken cancelToken, T blackboard, Object sharedProps) Context.withState(Object state, ICancelToken cancelToken) 类型变量类型为ICancelToken的cn.wjybxx.concurrent中的方法参数修饰符和类型方法说明CancelTokenSource.thenAccept(BiConsumer<? super ICancelToken, Object> action, Object ctx) CancelTokenSource.thenAccept(BiConsumer<? super ICancelToken, Object> action, Object ctx, int options) CancelTokenSource.thenAccept(Consumer<? super ICancelToken> action) CancelTokenSource.thenAccept(Consumer<? super ICancelToken> action, int options) ICancelToken.thenAccept(BiConsumer<? super ICancelToken, Object> action, Object ctx) ICancelToken.thenAccept(BiConsumer<? super ICancelToken, Object> action, Object ctx, int options) ICancelToken.thenAccept(Consumer<? super ICancelToken> action) ICancelToken.thenAccept(Consumer<? super ICancelToken> action, int options) 添加的action将在Context收到取消信号时执行 1.如果已收到取消请求,则给定的action会立即执行。ReadonlyCancelToken.thenAccept(BiConsumer<? super ICancelToken, Object> action, Object ctx) ReadonlyCancelToken.thenAccept(BiConsumer<? super ICancelToken, Object> action, Object ctx, int options) ReadonlyCancelToken.thenAccept(Consumer<? super ICancelToken> action) ReadonlyCancelToken.thenAccept(Consumer<? super ICancelToken> action, int options) CancelTokenSource.thenAcceptAsync(Executor executor, BiConsumer<? super ICancelToken, Object> action, Object ctx) CancelTokenSource.thenAcceptAsync(Executor executor, BiConsumer<? super ICancelToken, Object> action, Object ctx, int options) CancelTokenSource.thenAcceptAsync(Executor executor, Consumer<? super ICancelToken> action) CancelTokenSource.thenAcceptAsync(Executor executor, Consumer<? super ICancelToken> action, int options) ICancelToken.thenAcceptAsync(Executor executor, BiConsumer<? super ICancelToken, Object> action, Object ctx) ICancelToken.thenAcceptAsync(Executor executor, BiConsumer<? super ICancelToken, Object> action, Object ctx, int options) ICancelToken.thenAcceptAsync(Executor executor, Consumer<? super ICancelToken> action) ICancelToken.thenAcceptAsync(Executor executor, Consumer<? super ICancelToken> action, int options) ReadonlyCancelToken.thenAcceptAsync(Executor executor, BiConsumer<? super ICancelToken, Object> action, Object ctx) ReadonlyCancelToken.thenAcceptAsync(Executor executor, BiConsumer<? super ICancelToken, Object> action, Object ctx, int options) ReadonlyCancelToken.thenAcceptAsync(Executor executor, Consumer<? super ICancelToken> action) ReadonlyCancelToken.thenAcceptAsync(Executor executor, Consumer<? super ICancelToken> action, int options) 参数类型为ICancelToken的cn.wjybxx.concurrent中的构造器限定符构造器说明Context(Context<T> parent, Object state, ICancelToken cancelToken, T blackboard, Object sharedProps) 一般不建议直接调用该方法,而是通过Context.withBlackboard(Object)等创建子上下文,否则无法处理上下文继承问题。ReadonlyCancelToken(ICancelToken tokenSource) -
cn.wjybxx.sequential中ICancelToken的使用
参数类型为ICancelToken的cn.wjybxx.sequential中的方法类型变量类型为ICancelToken的cn.wjybxx.sequential中的方法参数修饰符和类型方法说明UniCancelTokenSource.thenAccept(BiConsumer<? super ICancelToken, Object> action, Object ctx) UniCancelTokenSource.thenAccept(BiConsumer<? super ICancelToken, Object> action, Object ctx, int options) UniCancelTokenSource.thenAccept(Consumer<? super ICancelToken> action) UniCancelTokenSource.thenAccept(Consumer<? super ICancelToken> action, int options) UniCancelTokenSource.thenAcceptAsync(Executor executor, BiConsumer<? super ICancelToken, Object> action, Object ctx) UniCancelTokenSource.thenAcceptAsync(Executor executor, BiConsumer<? super ICancelToken, Object> action, Object ctx, int options) UniCancelTokenSource.thenAcceptAsync(Executor executor, Consumer<? super ICancelToken> action) UniCancelTokenSource.thenAcceptAsync(Executor executor, Consumer<? super ICancelToken> action, int options)