Class DefaultWorkQueue<T>

java.lang.Object
io.kubernetes.client.extended.workqueue.DefaultWorkQueue<T>
All Implemented Interfaces:
WorkQueue<T>
Direct Known Subclasses:
DefaultDelayingQueue

public class DefaultWorkQueue<T> extends Object implements WorkQueue<T>
The default WorkQueue implementation that uses a doubly-linked list to store work items. This class ensures the added work items are, not in dirty set or currently processing set, before append them to the list.

Usage example, based on a typical producer-consumer scenario.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(T item)
    add marks item as needing processing.
    void
    done(T item)
    Done marks item as done processing, and if it has been marked as dirty again,
    get()
    Get blocks until it can return an item to be processed.
    boolean
    returns whether the queue shutdown.
    int
    length returns the current queue length, for informational purposes only.
    void
    ShutDown will cause q to ignore all new items added to it.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultWorkQueue

      public DefaultWorkQueue()
  • Method Details

    • add

      public void add(T item)
      Description copied from interface: WorkQueue
      add marks item as needing processing.
      Specified by:
      add in interface WorkQueue<T>
      Parameters:
      item - item to add
    • length

      public int length()
      Description copied from interface: WorkQueue
      length returns the current queue length, for informational purposes only.
      Specified by:
      length in interface WorkQueue<T>
      Returns:
      current queue length
    • get

      public T get() throws InterruptedException
      Description copied from interface: WorkQueue
      Get blocks until it can return an item to be processed. If shutdown = true, the caller should end their process.
      Specified by:
      get in interface WorkQueue<T>
      Returns:
      the object
      Throws:
      InterruptedException
    • done

      public void done(T item)
      Description copied from interface: WorkQueue
      Done marks item as done processing, and if it has been marked as dirty again,
      Specified by:
      done in interface WorkQueue<T>
      Parameters:
      item - specific item
    • shutDown

      public void shutDown()
      Description copied from interface: WorkQueue
      ShutDown will cause q to ignore all new items added to it.
      Specified by:
      shutDown in interface WorkQueue<T>
    • isShuttingDown

      public boolean isShuttingDown()
      Description copied from interface: WorkQueue
      returns whether the queue shutdown.
      Specified by:
      isShuttingDown in interface WorkQueue<T>
      Returns:
      returns true if the