EDU.oswego.cs.dl.util.concurrent
Class BoundedBuffer
java.lang.Object
EDU.oswego.cs.dl.util.concurrent.BoundedBuffer
- BoundedChannel, Channel, Puttable, Takable
public class BoundedBuffer
extends java.lang.Object
BoundedBuffer() - Create a buffer with the current default capacity
|
BoundedBuffer(int capacity) - Create a BoundedBuffer with the given capacity.
|
array_
protected final Object[] array_
emptySlots_
protected int emptySlots_
putMonitor_
protected final Object putMonitor_
Helper monitor to handle puts.
putPtr_
protected int putPtr_
takePtr_
protected int takePtr_
usedSlots_
protected int usedSlots_
BoundedBuffer
public BoundedBuffer()
Create a buffer with the current default capacity
BoundedBuffer
public BoundedBuffer(int capacity)
throws IllegalArgumentException
Create a BoundedBuffer with the given capacity.
extract
protected final Object extract()
incEmptySlots
protected void incEmptySlots()
incUsedSlots
protected void incUsedSlots()
insert
protected final void insert(Object x)
offer
public boolean offer(Object x,
long msecs)
throws InterruptedException
- offer in interface Channel
- offer in interface Puttable
poll
public Object poll(long msecs)
throws InterruptedException
- poll in interface Channel
- poll in interface Takable
put
public void put(Object x)
throws InterruptedException
- put in interface Channel
- put in interface Puttable
size
public int size()
Return the number of elements in the buffer.
This is only a snapshot value, that may change
immediately after returning.