Exemple #1
0
 /**
  * Returns a synchronized buffer backed by the given buffer that will
  * block on {@link Buffer#add(Object)} and
  * {@link Buffer#addAll(java.util.Collection)} until enough object(s) are
  * removed from the buffer to allow the object(s) to be added and still
  * maintain the maximum size or the timeout expires.
  *
  * @param buffer the buffer to make bounded, must not be null
  * @param maximumSize the maximum size
  * @param timeoutMillis  the timeout value in milliseconds, zero or less for no timeout
  * @return a bounded buffer backed by the given buffer
  * @throws IllegalArgumentException if the given buffer is null
  * @since Commons Collections 3.2
  */
 public static Buffer boundedBuffer(Buffer buffer, int maximumSize, long timeoutMillis)
 {
     return(BoundedBuffer.decorate(buffer, maximumSize, timeoutMillis));
 }
Exemple #2
0
 /**
  * Returns a synchronized buffer backed by the given buffer that will
  * block on {@link Buffer#add(Object)} and
  * {@link Buffer#addAll(java.util.Collection)} until enough object(s) are
  * removed from the buffer to allow the object(s) to be added and still
  * maintain the maximum size.
  *
  * @param buffer  the buffer to make bounded,  must not be null
  * @param maximumSize  the maximum size
  * @return a bounded buffer backed by the given buffer
  * @throws IllegalArgumentException if the given buffer is null
  * @since Commons Collections 3.2
  */
 public static Buffer boundedBuffer(Buffer buffer, int maximumSize)
 {
     return(BoundedBuffer.decorate(buffer, maximumSize));
 }