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
      boolean doOffer​(E e)
      offer element to the queue.
      EagerExecutorService getExecutor()
      get executor.
      default boolean offer​(E e)  
      default boolean retryOffer​(E o, long timeout, java.util.concurrent.TimeUnit unit)
      retry offer task.
      void setExecutor​(EagerExecutorService executor)
      set the executor.
      • Methods inherited from interface java.util.concurrent.BlockingQueue

        add, contains, drainTo, drainTo, offer, poll, put, remainingCapacity, remove, take
      • Methods inherited from interface java.util.Collection

        addAll, clear, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.Queue

        element, peek, poll, remove
    • Method Detail

      • setExecutor

        void setExecutor​(EagerExecutorService executor)
        set the executor.
        Parameters:
        executor - executor
      • offer

        default boolean offer​(E e)
        Specified by:
        offer in interface java.util.concurrent.BlockingQueue<E>
        Specified by:
        offer in interface java.util.Queue<E>
      • doOffer

        boolean doOffer​(E e)
        offer element to the queue.
        Parameters:
        e - the element to add
        Returns:
        true if the element was added to this queue, else false
      • retryOffer

        default boolean retryOffer​(E o,
                                   long timeout,
                                   java.util.concurrent.TimeUnit unit)
                            throws java.lang.InterruptedException
        retry offer task.
        Parameters:
        o - task
        timeout - timeout
        unit - 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.