Class SharedBuffer<T>
java.lang.Object
de.iip_ecosphere.platform.connectors.SharedBuffer<T>
- Type Parameters:
T- the entity type
A shared producer/consumer buffer.
- Author:
- Holger Eichelberger, SSE
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
buffer
-
capacity
private final int capacity
-
-
Constructor Details
-
SharedBuffer
public SharedBuffer(int capacity) Creates the buffer.- Parameters:
capacity- the initial capacity
-
-
Method Details
-
offer
Offers an entity to the queue.- Parameters:
value- the value to be offered- Throws:
InterruptedException
-
poll
Polls an entity from the buffer; if there is none, waits for the next entity.- Returns:
- the entity
- Throws:
InterruptedException- if waiting is interrupted
-
clear
public void clear()Clears the buffer.
-