public class EventRunnerGroup extends Object
Constructor and Description |
---|
EventRunnerGroup(ThreadPoolExecutor threadPoolExecutor,
int size,
boolean isSteal,
Function<EventRunner,Object> attachmentSupplier)
构造方法
|
Modifier and Type | Method and Description |
---|---|
EventRunner |
choseEventRunner()
选择一个时间执行器
|
EventRunner[] |
getEventRunners() |
ThreadPoolExecutor |
getThreadPool() |
boolean |
isSteal() |
static EventRunnerGroup |
newInstance(String groupName,
int size,
boolean isSteal,
int threadPriority,
Function<EventRunner,Object> attachmentSupplier)
静态构造方法
|
void |
setSteal(boolean steal) |
EventTask |
stealTask()
从任务最多的 EventRunner 窃取任务
|
public EventRunnerGroup(ThreadPoolExecutor threadPoolExecutor, int size, boolean isSteal, Function<EventRunner,Object> attachmentSupplier)
threadPoolExecutor
- 用于分发任务执行的线程池size
- 容纳事件执行器的数量isSteal
- 是否允许任务窃取attachmentSupplier
- 事件执行器的附属对象构造器public boolean isSteal()
public void setSteal(boolean steal)
public ThreadPoolExecutor getThreadPool()
public EventRunner[] getEventRunners()
public EventRunner choseEventRunner()
public EventTask stealTask()
public static EventRunnerGroup newInstance(String groupName, int size, boolean isSteal, int threadPriority, Function<EventRunner,Object> attachmentSupplier)
groupName
- 事件执行器名称size
- 容纳事件执行器的数量isSteal
- 是否允许任务窃取threadPriority
- 线程优先级attachmentSupplier
- 事件执行器的附属对象构造器Copyright © 2020 Voovan. All rights reserved.