Class TaskQueue<R extends Runnable>
java.lang.Object
java.util.AbstractCollection<Runnable>
java.util.AbstractQueue<Runnable>
java.util.concurrent.LinkedBlockingQueue<Runnable>
org.apache.dubbo.common.threadpool.support.eager.TaskQueue<R>
- All Implemented Interfaces:
Serializable,Iterable<Runnable>,Collection<Runnable>,BlockingQueue<Runnable>,Queue<Runnable>
TaskQueue in the EagerThreadPoolExecutor
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.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanretryOffer(Runnable o, long timeout, TimeUnit unit) retry offer taskvoidMethods inherited from class java.util.concurrent.LinkedBlockingQueue
clear, contains, drainTo, drainTo, forEach, iterator, offer, peek, poll, poll, put, remainingCapacity, remove, removeAll, removeIf, retainAll, size, spliterator, take, toArray, toArray, toStringMethods inherited from class java.util.AbstractQueue
add, addAll, element, removeMethods inherited from class java.util.AbstractCollection
containsAll, isEmptyMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.BlockingQueue
addMethods inherited from interface java.util.Collection
addAll, containsAll, equals, hashCode, isEmpty, parallelStream, stream, toArray
-
Constructor Details
-
TaskQueue
public TaskQueue(int capacity)
-
-
Method Details
-
setExecutor
-
offer
-
retryOffer
retry offer task- Parameters:
o- task- Returns:
- offer success or not
- Throws:
RejectedExecutionException- if executor is terminated.InterruptedException
-