public class MemorySafeTaskQueue<R extends java.lang.Runnable> extends MemorySafeLinkedBlockingQueue<java.lang.Runnable> implements TaskQueue<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.| Constructor and Description |
|---|
MemorySafeTaskQueue(java.util.Collection<? extends java.lang.Runnable> c,
int maxFreeMemory) |
MemorySafeTaskQueue(int maxFreeMemory) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
doOffer(java.lang.Runnable runnable)
offer element to the queue.
|
EagerExecutorService |
getExecutor()
get executor.
|
void |
setExecutor(EagerExecutorService executor)
set the executor.
|
getMaxFreeMemory, hasRemainedMemory, offer, offer, put, setMaxFreeMemory, setRejectorclear, contains, drainTo, drainTo, iterator, peek, poll, poll, remainingCapacity, remove, size, spliterator, take, toArray, toArray, toStringcontainsAll, isEmpty, removeAll, retainAllclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitoffer, retryOfferadd, contains, drainTo, drainTo, offer, poll, put, remainingCapacity, remove, takepublic MemorySafeTaskQueue(int maxFreeMemory)
public MemorySafeTaskQueue(java.util.Collection<? extends java.lang.Runnable> c,
int maxFreeMemory)
public EagerExecutorService getExecutor()
TaskQueuegetExecutor in interface TaskQueue<java.lang.Runnable>public void setExecutor(EagerExecutorService executor)
TaskQueuesetExecutor in interface TaskQueue<java.lang.Runnable>executor - executorpublic boolean doOffer(java.lang.Runnable runnable)
TaskQueueCopyright © 2024 The Apache Software Foundation. All rights reserved.