Class RegionNormalizerWorkQueue<E>

java.lang.Object
org.apache.hadoop.hbase.master.normalizer.RegionNormalizerWorkQueue<E>

@Private class RegionNormalizerWorkQueue<E> extends Object
A specialized collection that holds pending work for the RegionNormalizerWorker. It is an ordered collection class that has the following properties:
  • Guarantees uniqueness of elements, as a Set.
  • Consumers retrieve objects from the head, as a Queue, via take().
  • Work is retrieved on a FIFO policy.
  • Work retrieval blocks the calling thread until new work is available, as a BlockingQueue.
  • Allows a producer to insert an item at the head of the queue, if desired.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private LinkedHashSet<E>
    Underlying storage structure that gives us the Set behavior and FIFO retrieval policy.
    Lock for puts and takes
    private final Condition
    Wait queue for waiting takes
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Atomically removes all of the elements from this queue.
    void
    put(E e)
    Inserts the specified element at the tail of the queue, if it's not already present.
    void
    putAll(Collection<? extends E> c)
    Inserts the specified elements at the tail of the queue.
    void
    putAllFirst(Collection<? extends E> c)
    Inserts the specified elements at the head of the queue.
    void
    Inserts the specified element at the head of the queue.
    int
    Returns the number of elements in this queue.
    Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • put

      public void put(E e)
      Inserts the specified element at the tail of the queue, if it's not already present.
      Parameters:
      e - the element to add
    • putFirst

      public void putFirst(E e)
      Inserts the specified element at the head of the queue.
      Parameters:
      e - the element to add
    • putAll

      public void putAll(Collection<? extends E> c)
      Inserts the specified elements at the tail of the queue. Any elements already present in the queue are ignored.
      Parameters:
      c - the elements to add
    • putAllFirst

      public void putAllFirst(Collection<? extends E> c)
      Inserts the specified elements at the head of the queue.
      Parameters:
      c - the elements to add
    • take

      public E take() throws InterruptedException
      Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.
      Returns:
      the head of this queue
      Throws:
      InterruptedException - if interrupted while waiting
    • clear

      public void clear()
      Atomically removes all of the elements from this queue. The queue will be empty after this call returns.
    • size

      public int size()
      Returns the number of elements in this queue.
      Returns:
      the number of elements in this queue
    • toString

      public String toString()
      Overrides:
      toString in class Object