java.lang.Object
cn.wjybxx.sequential.AbstractUniExecutor
cn.wjybxx.sequential.AbstractUniScheduledExecutor
- 所有已实现的接口:
IExecutor,IExecutorService,IScheduledExecutorService,UniExecutorService,UniScheduledExecutor,AutoCloseable,Executor,ExecutorService,ScheduledExecutorService
- 直接已知子类:
DefaultUniScheduledExecutor
public abstract class AbstractUniScheduledExecutor
extends AbstractUniExecutor
implements UniScheduledExecutor
子类需要在
AbstractUniExecutor.execute(Runnable)的时候为任务赋值id和options- 作者:
- wjybxx date - 2023/4/7
-
字段概要
从类继承的字段 cn.wjybxx.sequential.AbstractUniExecutor
logger -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidvoid<V> IScheduledPromise<V> 创建一个promise以用于任务调度 如果当前Executor是SingleThreadExecutor,返回的future将禁止在当前EventLoop上执行阻塞操作。protected abstract voidremoveScheduled(UniScheduledPromiseTask<?> futureTask) 请求删除给定的任务protected abstract voidreSchedulePeriodic(UniScheduledPromiseTask<?> futureTask, boolean triggered) 请求将当前任务重新压入队列 1.一定从当前线程调用 2.如果无法继续调度任务,则取消任务<V> IScheduledFuture<V> schedule(ScheduledTaskBuilder<V> builder) 为避免过多的参数和重载方法,我们通过Builder构建更为复杂的任务。延迟指定时间后执行给定的任务 延迟指定时间后执行给定的任务<V> IScheduledFuture<V> 延迟指定时间后执行给定的任务 延迟指定时间后执行给定的任务scheduleAction(Consumer<? super IContext> task, IContext ctx, long delay, TimeUnit unit) 延迟指定时间后执行给定的任务scheduleAtFixedRate(Runnable task, long initialDelay, long period, TimeUnit unit) 以固定频率执行给定的任务(少执行了会补-慎用) 以固定频率执行给定的任务(少执行了会补-慎用)<V> IScheduledFuture<V> scheduleFunc(Function<? super IContext, V> task, IContext ctx, long delay, TimeUnit unit) 延迟指定时间后执行给定的任务scheduleWithFixedDelay(Runnable task, long initialDelay, long delay, TimeUnit unit) 以固定延迟执行给定的任务(少执行了就少执行了) 以固定延迟执行给定的任务(少执行了就少执行了)<V> IFuture<V> submit(TaskBuilder<V> builder) <T> IFuture<T> IFuture<?> submitAction(Runnable task) IFuture<?> submitAction(Runnable task, int options) IFuture<?> submitAction(Consumer<? super IContext> task, IContext ctx) IFuture<?> submitAction(Consumer<? super IContext> task, IContext ctx, int options) <V> IFuture<V> submitFunc(Callable<? extends V> task) <V> IFuture<V> submitFunc(Callable<? extends V> task, int options) <V> IFuture<V> submitFunc(Function<? super IContext, ? extends V> task, IContext ctx) <V> IFuture<V> submitFunc(Function<? super IContext, ? extends V> task, IContext ctx, int options) protected abstract longtickTime()当前线程的时间 1.从类继承的方法 cn.wjybxx.sequential.AbstractUniExecutor
awaitTermination, execute, execute, logCause, newPromise, safeExecute从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 java.util.concurrent.ExecutorService
close从接口继承的方法 cn.wjybxx.concurrent.IExecutorService
awaitTermination, isShutdown, isShuttingDown, isTerminated, newPromise, shutdown, shutdownNow, submit, submit, terminationFuture从接口继承的方法 cn.wjybxx.sequential.UniExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, needMoreUpdate, update
-
构造器详细资料
-
AbstractUniScheduledExecutor
public AbstractUniScheduledExecutor()
-
-
方法详细资料
-
newScheduledPromise
从接口复制的说明:IScheduledExecutorService创建一个promise以用于任务调度 如果当前Executor是SingleThreadExecutor,返回的future将禁止在当前EventLoop上执行阻塞操作。- 指定者:
newScheduledPromise在接口中IScheduledExecutorService
-
schedule
从接口复制的说明:IScheduledExecutorService为避免过多的参数和重载方法,我们通过Builder构建更为复杂的任务。- 指定者:
schedule在接口中IScheduledExecutorService- 类型参数:
V- 任务的结果类型- 参数:
builder- 任务构建器。- 返回:
- future
-
scheduleFunc
public <V> IScheduledFuture<V> scheduleFunc(Function<? super IContext, V> task, IContext ctx, long delay, TimeUnit unit) 从接口复制的说明:IScheduledExecutorService延迟指定时间后执行给定的任务- 指定者:
scheduleFunc在接口中IScheduledExecutorService- 参数:
task- 要执行的任务ctx- 上下文-主要是取消令牌
-
scheduleAction
public IScheduledFuture<?> scheduleAction(Consumer<? super IContext> task, IContext ctx, long delay, TimeUnit unit) 从接口复制的说明:IScheduledExecutorService延迟指定时间后执行给定的任务- 指定者:
scheduleAction在接口中IScheduledExecutorService- 参数:
task- 要执行的任务ctx- 上下文-主要是取消令牌
-
schedule
从接口复制的说明:IScheduledExecutorService延迟指定时间后执行给定的任务- 指定者:
schedule在接口中IScheduledExecutorService- 指定者:
schedule在接口中ScheduledExecutorService
-
schedule
从接口复制的说明:IScheduledExecutorService延迟指定时间后执行给定的任务- 指定者:
schedule在接口中IScheduledExecutorService- 指定者:
schedule在接口中ScheduledExecutorService
-
scheduleAtFixedRate
public IScheduledFuture<?> scheduleAtFixedRate(Runnable task, long initialDelay, long period, TimeUnit unit) 从接口复制的说明:IScheduledExecutorService以固定频率执行给定的任务(少执行了会补-慎用)- 指定者:
scheduleAtFixedRate在接口中IScheduledExecutorService- 指定者:
scheduleAtFixedRate在接口中ScheduledExecutorService
-
scheduleWithFixedDelay
public IScheduledFuture<?> scheduleWithFixedDelay(Runnable task, long initialDelay, long delay, TimeUnit unit) 从接口复制的说明:IScheduledExecutorService以固定延迟执行给定的任务(少执行了就少执行了) -
submit
- 指定者:
submit在接口中IExecutorService- 覆盖:
submit在类中AbstractUniExecutor
-
execute
从接口复制的说明:IExecutor- 指定者:
execute在接口中IExecutor- 覆盖:
execute在类中AbstractUniExecutor- 参数:
action- 要执行的任务ctx- 任务绑定的上下文
-
execute
- 指定者:
execute在接口中IExecutor- 覆盖:
execute在类中AbstractUniExecutor
-
submit
- 指定者:
submit在接口中ExecutorService- 指定者:
submit在接口中IExecutorService- 覆盖:
submit在类中AbstractUniExecutor
-
submitFunc
- 指定者:
submitFunc在接口中IExecutorService- 覆盖:
submitFunc在类中AbstractUniExecutor
-
submitFunc
- 指定者:
submitFunc在接口中IExecutorService- 覆盖:
submitFunc在类中AbstractUniExecutor
-
submitFunc
- 指定者:
submitFunc在接口中IExecutorService- 覆盖:
submitFunc在类中AbstractUniExecutor
-
submitFunc
public <V> IFuture<V> submitFunc(Function<? super IContext, ? extends V> task, IContext ctx, int options) - 指定者:
submitFunc在接口中IExecutorService- 覆盖:
submitFunc在类中AbstractUniExecutor
-
submitAction
- 指定者:
submitAction在接口中IExecutorService- 覆盖:
submitAction在类中AbstractUniExecutor
-
submitAction
- 指定者:
submitAction在接口中IExecutorService- 覆盖:
submitAction在类中AbstractUniExecutor
-
submitAction
- 指定者:
submitAction在接口中IExecutorService- 覆盖:
submitAction在类中AbstractUniExecutor
-
submitAction
- 指定者:
submitAction在接口中IExecutorService- 覆盖:
submitAction在类中AbstractUniExecutor
-
tickTime
protected abstract long tickTime()当前线程的时间 1. 可以使用缓存的时间,也可以使用实时查询,只要不破坏任务的执行约定即可。 2. 如果使用缓存时间,接口中并不约定时间的更新时机,也不约定一个大循环只更新一次。也就是说,线程可能在任意时间点更新缓存的时间,只要不破坏线程安全性和约定的任务时序。 -
reSchedulePeriodic
protected abstract void reSchedulePeriodic(UniScheduledPromiseTask<?> futureTask, boolean triggered) 请求将当前任务重新压入队列 1.一定从当前线程调用 2.如果无法继续调度任务,则取消任务- 参数:
triggered- 是否是执行之后压入队列;通常用于在执行成功之后降低优先级
-
removeScheduled
请求删除给定的任务
-