Class BoundedBuffer<T>


  • public class BoundedBuffer<T>
    extends java.lang.Object
    Adapted from the example in Java Concurrency in Practice to add new methods like pause, resume, size, and uninterruptibles.
    Author:
    Brian Goetz and Tim Peierls, Evren Sirin
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.concurrent.locks.Lock lock  
    • Constructor Summary

      Constructors 
      Constructor Description
      BoundedBuffer​(int size)  
    • Field Detail

      • lock

        protected final java.util.concurrent.locks.Lock lock
    • Constructor Detail

      • BoundedBuffer

        public BoundedBuffer​(int size)
    • Method Detail

      • put

        public void put​(T x)
                 throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • take

        public T take()
               throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • putUninterruptibly

        public void putUninterruptibly​(T x)
      • takeUninterruptly

        public T takeUninterruptly()
      • pause

        public void pause()
      • resume

        public void resume()
      • clear

        public void clear()
      • size

        public int size()