|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jarol.PortEnhanced
public class PortEnhanced
PortEnhanced is a data transfer point that provides concurrent access for a single-reader and
a single-writer with enhanced semantics that will never block the writer.
The internal buffer is a pushing buffer, thus the oldest value is
replaced with the newest value iff the buffer is full.
There is no support for multiple readers or writers. All items that are put and taken from the buffer
are cloned, also all items must implement the MessageInterface
to provide cloning.
Constructor Summary | |
---|---|
PortEnhanced()
Constructs an enhanced port with the standard buffer size. |
|
PortEnhanced(int size)
Creates an enhanced port with a specified buffer size. |
Method Summary | |
---|---|
int |
getBufferSize()
Returns the buffer size. |
MessageInterface |
read()
Reads the oldest element from the buffer without blocking. |
void |
write(MessageInterface item)
Writes an item into the buffer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PortEnhanced()
public PortEnhanced(int size)
size
- indicates the size of the bufferMethod Detail |
---|
public int getBufferSize()
public MessageInterface read()
public void write(MessageInterface item)
item
- - The element to be added into the buffer.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |