app.util
Class SynchBufSingleProd<E>

java.lang.Object
  extended by app.util.SynchBufSingleProd<E>
Direct Known Subclasses:
SynchBufMultiProd

public class SynchBufSingleProd<E>
extends java.lang.Object

A synchronized buffer with a generic buffered item type, for the use of a single producer thread and a single consumer thread. The producer uses the put(Object) method to insert an item, and the consumer uses the get() method to extract an item. The transfer of an item from producer to consumer using these operations is a completely synchronized distributed assignment, i.e. it's a rendezvous with a data exchange: the exchange is perfomed only when both partners are available, and each partner's transfer operation completes only after the exchange itself is completed.


Constructor Summary
SynchBufSingleProd()
          Constructs a new synchronized buffer.
 
Method Summary
 E get()
          Consumer side of a synchronized distributed exchange via this buffer.
 void put(E item)
          Producer side of a synchronized distributed exchange via this buffer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynchBufSingleProd

public SynchBufSingleProd()
Constructs a new synchronized buffer.

Method Detail

put

public void put(E item)
         throws java.lang.InterruptedException
Producer side of a synchronized distributed exchange via this buffer.

Throws:
java.lang.InterruptedException

get

public final E get()
            throws java.lang.InterruptedException
Consumer side of a synchronized distributed exchange via this buffer.

Throws:
java.lang.InterruptedException