Interface TaskQueue<E>
-
- All Superinterfaces:
java.util.concurrent.BlockingQueue<E>,java.util.Collection<E>,java.lang.Iterable<E>,java.util.Queue<E>
- All Known Implementing Classes:
MemoryLimitedTaskQueue,MemorySafeTaskQueue
public interface TaskQueue<E> extends java.util.concurrent.BlockingQueue<E>TaskQueue.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleandoOffer(E e)offer element to the queue.EagerExecutorServicegetExecutor()get executor.default booleanoffer(E e)default booleanretryOffer(E o, long timeout, java.util.concurrent.TimeUnit unit)retry offer task.voidsetExecutor(EagerExecutorService executor)set the executor.-
Methods inherited from interface java.util.concurrent.BlockingQueue
add, contains, drainTo, drainTo, offer, poll, put, remainingCapacity, remove, take
-
-
-
-
Method Detail
-
getExecutor
EagerExecutorService getExecutor()
get executor.- Returns:
- the executor
-
setExecutor
void setExecutor(EagerExecutorService executor)
set the executor.- Parameters:
executor- executor
-
offer
default boolean offer(E e)
-
doOffer
boolean doOffer(E e)
offer element to the queue.- Parameters:
e- the element to add- Returns:
trueif the element was added to this queue, elsefalse
-
retryOffer
default boolean retryOffer(E o, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
retry offer task.- Parameters:
o- tasktimeout- timeoutunit- timeout unit- Returns:
- offer success or not
- Throws:
java.util.concurrent.RejectedExecutionException- if executor is terminated.java.lang.InterruptedException- if the current thread is interrupted.
-
-