public class MemoryLimitedTaskQueue<R extends java.lang.Runnable> extends MemoryLimitedLinkedBlockingQueue<java.lang.Runnable>
ShenyuThreadPoolExecutor.
It offer a task if the executor's submittedTaskCount less than currentPoolThreadSize
or the currentPoolThreadSize more than executor's maximumPoolSize.
That can make the executor create new worker
when the task num is bigger than corePoolSize but less than maximumPoolSize.| 构造器和说明 |
|---|
MemoryLimitedTaskQueue(java.lang.instrument.Instrumentation inst) |
MemoryLimitedTaskQueue(long memoryLimit,
java.lang.instrument.Instrumentation inst) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
offer(java.lang.Runnable runnable) |
boolean |
retryOffer(java.lang.Runnable o,
long timeout,
java.util.concurrent.TimeUnit unit)
retry offer task.
|
void |
setExecutor(ShenyuThreadPoolExecutor executor)
set the executor.
|
clear, getCurrentMemory, getCurrentRemainMemory, getMemoryLimit, offer, poll, poll, put, remove, setMemoryLimit, takecontains, drainTo, drainTo, iterator, peek, remainingCapacity, size, spliterator, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic MemoryLimitedTaskQueue(java.lang.instrument.Instrumentation inst)
public MemoryLimitedTaskQueue(long memoryLimit,
java.lang.instrument.Instrumentation inst)
public void setExecutor(ShenyuThreadPoolExecutor executor)
executor - executorpublic boolean offer(java.lang.Runnable runnable)
offer 在接口中 java.util.concurrent.BlockingQueue<java.lang.Runnable>offer 在接口中 java.util.Queue<java.lang.Runnable>offer 在类中 MemoryLimitedLinkedBlockingQueue<java.lang.Runnable>public boolean retryOffer(java.lang.Runnable o,
long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
o - tasktimeout - timeoutunit - timeout unitjava.util.concurrent.RejectedExecutionException - if executor is terminated.java.lang.InterruptedException - if the current thread is interrupted.Copyright © 2022 The Apache Software Foundation. All rights reserved.