Class MPMCBlockingQueue<E>

    • Field Detail

      • queueNotFullCondition

        protected final com.conversantmedia.util.concurrent.Condition queueNotFullCondition
      • queueNotEmptyCondition

        protected final com.conversantmedia.util.concurrent.Condition queueNotEmptyCondition
      • size

        protected final int size
    • Constructor Detail

      • MPMCBlockingQueue

        public MPMCBlockingQueue​(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
      • MPMCBlockingQueue

        public MPMCBlockingQueue​(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, suggest using a power of 2
        spinPolicy - - determine the level of cpu aggressiveness in waiting
      • MPMCBlockingQueue

        public MPMCBlockingQueue​(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