Class PushPullBlockingQueue<E>

java.lang.Object
com.conversantmedia.util.concurrent.PushPullConcurrentQueue<E>
com.conversantmedia.util.concurrent.PushPullBlockingQueue<E>
All Implemented Interfaces:
ConcurrentQueue<E>, Serializable, Iterable<E>, Collection<E>, BlockingQueue<E>, Queue<E>

public final class PushPullBlockingQueue<E> extends PushPullConcurrentQueue<E> implements Serializable, Iterable<E>, Collection<E>, BlockingQueue<E>, Queue<E>
Single thread implementation of disruptor
See Also:
  • Field Details

    • queueNotFullCondition

      protected final Condition queueNotFullCondition
    • queueNotEmptyCondition

      protected final Condition queueNotEmptyCondition
  • Constructor Details

    • PushPullBlockingQueue

      public PushPullBlockingQueue(int capacity)

      Construct a blocking queue of the given fixed capacity.

      Note: actual capacity will be the next power of two larger than capacity.
      Parameters:
      capacity - maximum capacity of this queue
    • PushPullBlockingQueue

      public PushPullBlockingQueue(int capacity, SpinPolicy spinPolicy)

      Construct a blocking queue with a given fixed capacity

      Note: actual capacity will be the next power of two larger than capacity. Waiting locking may be used in servers that are tuned for it, waiting locking provides a high performance locking implementation which is approximately a factor of 2 improvement in throughput (40M/s for 1-1 thread transfers) However waiting locking is more CPU aggressive and causes servers that may be configured with far too many threads to show very high load averages. This is probably not as detrimental as it is annoying.
      Parameters:
      capacity - - the queue capacity, power of two is suggested
      spinPolicy - - determine the level of cpu aggressiveness in waiting
    • PushPullBlockingQueue

      public PushPullBlockingQueue(int capacity, Collection<? extends E> c)

      Construct a blocking queue of the given fixed capacity

      Note: actual capacity will be the next power of two larger than capacity.

      The values from the collection, c, are appended to the queue in iteration order. If the number of elements in the collection exceeds the actual capacity, then the additional elements overwrite the previous ones until all elements have been written once.
      Parameters:
      capacity - maximum capacity of this queue
      c - A collection to use to populate inital values
  • Method Details