Package com.complexible.common.collect
Class BoundedBuffer<T>
- java.lang.Object
-
- com.complexible.common.collect.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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
void
pause()
void
put(T x)
void
putUninterruptibly(T x)
void
resume()
int
size()
T
take()
T
takeUninterruptly()
-
-
-
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()
-
-