java.lang.Object
cn.wjybxx.concurrent.AbstractEventLoop
- 所有已实现的接口:
EventLoop,EventLoopGroup,FixedEventLoopGroup,IExecutor,IExecutorService,IScheduledExecutorService,SingleThreadExecutor,AutoCloseable,Iterable<EventLoop>,Executor,ExecutorService,ScheduledExecutorService
- 直接已知子类:
DisruptorEventLoop
- 作者:
- wjybxx date 2023/4/7
-
字段概要
字段修饰符和类型字段说明protected static final org.slf4j.Loggerprotected final EventLoopGroupprotected final Collection<EventLoop> -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明intEventLoop的数量。final voidfinal voidensureInEventLoop(String method) abstract void在将来的某个时间执行给定的命令。void在将来的某个时间执行给定的命令。voidvoidfinal voidinvokeAll(Collection<? extends Callable<T>> tasks) invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) <T> TinvokeAny(Collection<? extends Callable<T>> tasks) <T> TinvokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) iterator()注意;如果包含不定数量的EventLoop,返回的是快照。protected static void<T> IPromise<T> 创建一个promise以用于任务调度 如果当前Executor是SingleThreadExecutor,返回的future将禁止在当前EventLoop上执行阻塞操作。parent()返回该EventLoop线程所在的线程组(管理该EventLoop的容器)。select()选择一个EventLoop用于接下来的任务调度select(int key) final Spliterator<EventLoop> <T> IFuture<T> submit(TaskBuilder<T> builder) <T> IFuture<T> IFuture<?> submitAction(Runnable task) IFuture<?> submitAction(Runnable task, int options) 该方法可能和ExecutorService.submit(Runnable, Object)冲突,因此我们要带后缀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) final voidthrowIfInEventLoop(String method) 从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 cn.wjybxx.concurrent.EventLoop
inEventLoop, inEventLoop, isRunning, mainModule, runningFuture, start, state, wakeup从接口继承的方法 cn.wjybxx.concurrent.EventLoopGroup
awaitTermination, isShutdown, isShuttingDown, isTerminated, shutdown, shutdownNow, terminationFuture从接口继承的方法 java.util.concurrent.ExecutorService
close从接口继承的方法 cn.wjybxx.concurrent.IExecutorService
submit, submit从接口继承的方法 cn.wjybxx.concurrent.IScheduledExecutorService
newScheduledPromise, schedule, schedule, schedule, scheduleAction, scheduleAtFixedRate, scheduleFunc, scheduleWithFixedDelay
-
字段详细资料
-
logger
protected static final org.slf4j.Logger logger -
parent
-
selfCollection
-
-
构造器详细资料
-
AbstractEventLoop
-
-
方法详细资料
-
execute
从接口复制的说明:IExecutor在将来的某个时间执行给定的命令。 命令可以在新线程中执行,也可以在池线程中执行,或者在调用线程中执行,这由Executor实现决定。Executor.execute(Runnable) -
execute
从接口复制的说明:IExecutor在将来的某个时间执行给定的命令。 命令可以在新线程中执行,也可以在池线程中执行,或者在调用线程中执行,这由Executor实现决定。Executor.execute(Runnable)任务的调度特征值 1.Executor需要感知用户任务的一些属性,以实现更好的管理。 2.选项可参考
TaskOption。 3.该接口不应该测试任务的类型,应当以参数的options为准。- 指定者:
execute在接口中IExecutor- 参数:
command- 要执行的任务options- 任务的调度特征值,见TaskOption
-
execute
从接口复制的说明:IExecutor -
execute
-
parent
从接口复制的说明:EventLoop返回该EventLoop线程所在的线程组(管理该EventLoop的容器)。 如果没有父节点,返回null。 -
select
从接口复制的说明:EventLoopGroup选择一个EventLoop用于接下来的任务调度- 指定者:
select在接口中EventLoop- 指定者:
select在接口中EventLoopGroup- 返回:
- this - 由于
EventLoop表示单个线程,因此总是分配自己。
-
select
从接口复制的说明:FixedEventLoopGroup通过一个键选择一个EventLoop这提供了第二种绑定线程的方式,第一种方式是通过EventLoopGroup.select()分配一个线程,让业务对象持有EventLoop的引用。 现在,你可以为用户分配一个键,通过键建立虚拟绑定。- 指定者:
select在接口中EventLoop- 指定者:
select在接口中FixedEventLoopGroup- 参数:
key- 计算索引的键;限定int可保证选择性能- 返回:
- this - 由于
EventLoop表示单个线程,因此总是选中自己
-
childCount
public int childCount()从接口复制的说明:FixedEventLoopGroupEventLoop的数量。- 指定者:
childCount在接口中FixedEventLoopGroup
-
ensureInEventLoop
public final void ensureInEventLoop()- 指定者:
ensureInEventLoop在接口中EventLoop
-
ensureInEventLoop
- 指定者:
ensureInEventLoop在接口中EventLoop
-
throwIfInEventLoop
-
newPromise
从接口复制的说明:IExecutorService创建一个promise以用于任务调度 如果当前Executor是SingleThreadExecutor,返回的future将禁止在当前EventLoop上执行阻塞操作。- 指定者:
newPromise在接口中IExecutorService
-
submit
- 指定者:
submit在接口中IExecutorService
-
submit
- 指定者:
submit在接口中ExecutorService- 指定者:
submit在接口中IExecutorService
-
submitFunc
- 指定者:
submitFunc在接口中IExecutorService
-
submitFunc
- 指定者:
submitFunc在接口中IExecutorService
-
submitFunc
- 指定者:
submitFunc在接口中IExecutorService
-
submitFunc
public <V> IFuture<V> submitFunc(Function<? super IContext, ? extends V> task, IContext ctx, int options) - 指定者:
submitFunc在接口中IExecutorService
-
submitAction
- 指定者:
submitAction在接口中IExecutorService
-
submitAction
该方法可能和ExecutorService.submit(Runnable, Object)冲突,因此我们要带后缀- 指定者:
submitAction在接口中IExecutorService
-
submitAction
- 指定者:
submitAction在接口中IExecutorService
-
submitAction
- 指定者:
submitAction在接口中IExecutorService
-
invokeAny
@Nonnull public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException - 指定者:
invokeAny在接口中ExecutorService- 指定者:
invokeAny在接口中IExecutorService- 抛出:
InterruptedExceptionExecutionException
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - 指定者:
invokeAny在接口中ExecutorService- 指定者:
invokeAny在接口中IExecutorService- 抛出:
InterruptedExceptionExecutionExceptionTimeoutException
-
invokeAll
@Nonnull public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException - 指定者:
invokeAll在接口中ExecutorService- 指定者:
invokeAll在接口中IExecutorService- 抛出:
InterruptedException
-
invokeAll
@Nonnull public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException - 指定者:
invokeAll在接口中ExecutorService- 指定者:
invokeAll在接口中IExecutorService- 抛出:
InterruptedException
-
iterator
从接口复制的说明:EventLoopGroup注意;如果包含不定数量的EventLoop,返回的是快照。- 指定者:
iterator在接口中EventLoopGroup- 指定者:
iterator在接口中Iterable<EventLoop>
-
forEach
-
spliterator
- 指定者:
spliterator在接口中Iterable<EventLoop>
-
logCause
-