public class QueuesExecutorService extends AbstractExecutorService implements QueueGroupExecutor
| 限定符和类型 | 类和说明 |
|---|---|
static class |
QueuesExecutorService.Builder |
protected static interface |
QueuesExecutorService.WorkerExitTask |
QueueGroupExecutor.KeyElement<T>| 限定符和类型 | 字段和说明 |
|---|---|
protected org.slf4j.Logger |
log |
| 限定符 | 构造器和说明 |
|---|---|
|
QueuesExecutorService() |
|
QueuesExecutorService(int corePoolSize,
int maximumPoolSize) |
|
QueuesExecutorService(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
ThreadFactory threadFactory,
WaitConditionStrategy waitConditionStrategy,
Queue<Runnable> bossQueue,
QueueGroupManager queueMananger,
Executor assistExecutor) |
protected |
QueuesExecutorService(int corePoolSize,
int maximumPoolSize,
Queue<Runnable> bossQueue) |
protected |
QueuesExecutorService(int corePoolSize,
int maximumPoolSize,
Queue<Runnable> bossQueue,
QueueGroupManager queueMananger) |
protected |
QueuesExecutorService(int corePoolSize,
int maximumPoolSize,
Queue<Runnable> bossQueue,
QueueGroupManager queueMananger,
WaitConditionStrategy waitConditionStrategy) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit) |
void |
execute(Runnable command) |
void |
execute(String key,
List<Runnable> tasks) |
void |
execute(String key,
Runnable task) |
int |
getActiveCount() |
Executor |
getAssistExecutor() |
long |
getCompletedTaskCount() |
int |
getCorePoolSize() |
long |
getKeepAliveTime(TimeUnit unit) |
int |
getLargestPoolSize() |
int |
getMaximumPoolSize() |
int |
getPoolSize() |
QueueExecutor |
getQueueExecutor(String key) |
QueueGroupManager |
getQueueGroupManager() |
ThreadFactory |
getThreadFactory() |
boolean |
hasQueueExecutor(String key) |
boolean |
isAllowCoreThreadTimeOut() |
boolean |
isShutdown() |
boolean |
isTerminated() |
boolean |
isTerminating() |
Iterator<QueueGroupExecutor.KeyElement<QueueExecutor>> |
keyIterator() |
void |
setAllowCoreThreadTimeOut(boolean allowCoreThreadTimeOut) |
void |
setCorePoolSize(int corePoolSize) |
void |
setKeepAliveTime(long keepAliveTime,
TimeUnit unit) |
protected void |
setLargestPoolSize(int size) |
void |
setMaximumPoolSize(int maximumPoolSize) |
void |
setThreadFactory(ThreadFactory threadFactory) |
void |
shutdown()
使用WorkerExitTask结束任务,防止之前的任务因停止而丢失
|
List<Runnable> |
shutdownNow() |
void |
shutdownSync()
同步关闭
|
protected void |
systemExecute(List<Runnable> tasks) |
protected void |
systemExecute(Runnable task) |
protected void |
systemTaskOfferAfter(net.jueb.util4j.queue.queueExecutor.groupExecutor.impl.QueuesExecutorService.SystemQueue queue)
队列添加事件执行之后
|
protected void |
systemTaskOfferBefore(net.jueb.util4j.queue.queueExecutor.groupExecutor.impl.QueuesExecutorService.SystemQueue queue)
队列添加事件执行之前
|
void |
wakeUpWorkerIfNecessary()
唤醒工作线程(如果还没超过最大工作线程)
|
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submitpublic QueuesExecutorService()
public QueuesExecutorService(int corePoolSize,
int maximumPoolSize)
protected QueuesExecutorService(int corePoolSize,
int maximumPoolSize,
Queue<Runnable> bossQueue)
protected QueuesExecutorService(int corePoolSize,
int maximumPoolSize,
Queue<Runnable> bossQueue,
QueueGroupManager queueMananger)
protected QueuesExecutorService(int corePoolSize,
int maximumPoolSize,
Queue<Runnable> bossQueue,
QueueGroupManager queueMananger,
WaitConditionStrategy waitConditionStrategy)
public QueuesExecutorService(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
ThreadFactory threadFactory,
WaitConditionStrategy waitConditionStrategy,
Queue<Runnable> bossQueue,
QueueGroupManager queueMananger,
Executor assistExecutor)
corePoolSize - 核心线程池数量maximumPoolSize - 最大线程数量keepAliveTime - 非核心线程活跃时长unit - 单位threadFactory - 线程工厂waitConditionStrategy - 线程等待机制bossQueue - 主队列queueMananger - 键值队列管理器assistExecutor - 辅助执行器,用于启动工作线程或处理其它逻辑public final ThreadFactory getThreadFactory()
public final void setThreadFactory(ThreadFactory threadFactory)
public Executor getAssistExecutor()
public long getKeepAliveTime(TimeUnit unit)
public void setKeepAliveTime(long keepAliveTime,
TimeUnit unit)
public boolean isAllowCoreThreadTimeOut()
public void setAllowCoreThreadTimeOut(boolean allowCoreThreadTimeOut)
public int getCorePoolSize()
public void setCorePoolSize(int corePoolSize)
public int getMaximumPoolSize()
public void setMaximumPoolSize(int maximumPoolSize)
public int getPoolSize()
public int getActiveCount()
public int getLargestPoolSize()
protected void setLargestPoolSize(int size)
public boolean awaitTermination(long timeout,
TimeUnit unit)
throws InterruptedException
awaitTermination 在接口中 ExecutorServiceInterruptedExceptionpublic boolean isShutdown()
isShutdown 在接口中 ExecutorServicepublic boolean isTerminated()
isTerminated 在接口中 ExecutorServicepublic void shutdown()
shutdown 在接口中 ExecutorServicepublic void shutdownSync()
public boolean isTerminating()
public void wakeUpWorkerIfNecessary()
protected void systemTaskOfferBefore(net.jueb.util4j.queue.queueExecutor.groupExecutor.impl.QueuesExecutorService.SystemQueue queue)
queue - protected void systemTaskOfferAfter(net.jueb.util4j.queue.queueExecutor.groupExecutor.impl.QueuesExecutorService.SystemQueue queue)
queue - public long getCompletedTaskCount()
protected void systemExecute(Runnable task)
public QueueGroupManager getQueueGroupManager()
getQueueGroupManager 在接口中 QueueGroupExecutorpublic void execute(String key, Runnable task)
execute 在接口中 QueueGroupExecutorpublic void execute(String key, List<Runnable> tasks)
execute 在接口中 QueueGroupExecutorpublic boolean hasQueueExecutor(String key)
hasQueueExecutor 在接口中 QueueGroupExecutorpublic QueueExecutor getQueueExecutor(String key)
getQueueExecutor 在接口中 QueueGroupExecutorpublic Iterator<QueueGroupExecutor.KeyElement<QueueExecutor>> keyIterator()
keyIterator 在接口中 QueueGroupExecutorpublic List<Runnable> shutdownNow()
shutdownNow 在接口中 ExecutorServiceCopyright © 2020. All rights reserved.