接口的使用
cn.wjybxx.base.concurrent.ICancelToken
使用ICancelToken的程序包
-
cn.wjybxx.base.concurrent中ICancelToken的使用
修饰符和类型方法说明IContext.cancelToken()任务绑定的取消令牌(取消上下文) 1.每个任务可有独立的取消信号 -- 私有属性。MiniContext.cancelToken()static ICancelTokenExecutorCoreUtils.getCancelToken(Object ctx, int options) 获取上下文中的取消令牌参数类型为ICancelToken的cn.wjybxx.base.concurrent中的方法修饰符和类型方法说明static MiniContextMiniContext.ofState(Object state, ICancelToken cancelToken) voidICancelTokenListener.onCancelRequested(ICancelToken cancelToken, Object ctx) 该方法在取消令牌收到取消信号时执行static ITaskExecutorCoreUtils.toTask(Runnable action, ICancelToken cancelToken, int options) 类型变量类型为ICancelToken的cn.wjybxx.base.concurrent中的方法参数修饰符和类型方法说明ICancelToken.thenAccept(BiConsumer<? super ICancelToken, Object> action, Object ctx) ICancelToken.thenAccept(BiConsumer<? super ICancelToken, Object> action, Object ctx, int options) 添加的action将在Token收到取消信号时执行 1.如果已收到取消请求,则给定的action会立即执行。ICancelToken.thenAccept(Consumer<? super ICancelToken> action) ICancelToken.thenAccept(Consumer<? super ICancelToken> action, int options) 添加的action将在Token收到取消信号时执行 1.如果已收到取消请求,则给定的action会立即执行。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)