|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.kwfgrid.gwes.uiproxy.AbstractBuffer
net.kwfgrid.gwes.uiproxy.SequenceBuffer
public abstract class SequenceBuffer
An abstract buffer implementation to order messages with sequence numbers.
Subclasses must implement getSequenceNumber(message) to access the sequence number of an incoming message.
A SequenceBuffer's client must explicitly initialize the buffer by setting the SequenceBuffer.first
property to the first valid sequence number. The buffer will not return any messages on read() before
this property has been set.
This buffer supports the following properties:
| Field Summary | |
|---|---|
protected LinkedList |
_content
|
protected BufferException |
_exception
|
protected int |
_first
|
protected boolean |
_initialized
|
protected LinkedList |
_precontent
|
static String |
FIRST_PROPERTY_KEY
|
| Fields inherited from class net.kwfgrid.gwes.uiproxy.AbstractBuffer |
|---|
_id, _size, DEFAULT_SIZE, SIZE_PROPERTY_KEY |
| Constructor Summary | |
|---|---|
SequenceBuffer()
|
|
| Method Summary | |
|---|---|
protected abstract int |
getSequenceNumber(Object message)
Generic method to access the sequence number of the specified message. |
void |
handle(Object message)
Handle a message. |
protected void |
initialize(int first)
|
Object[] |
read()
Will always return messages in correct order. |
void |
setProperty(String key,
String value)
This implementation only interprets the Buffer.size property. |
protected void |
setSize(int size)
Size should be set by setting property Buffer.size. |
protected abstract boolean |
shouldHandle(Object message)
Determine if this buffer should handle the specified message. |
| Methods inherited from class net.kwfgrid.gwes.uiproxy.AbstractBuffer |
|---|
getID, getSize, setID, setProperties |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String FIRST_PROPERTY_KEY
protected int _first
protected boolean _initialized
protected BufferException _exception
protected LinkedList _content
protected LinkedList _precontent
| Constructor Detail |
|---|
public SequenceBuffer()
| Method Detail |
|---|
protected abstract int getSequenceNumber(Object message)
throws Exception
Exception
protected void setSize(int size)
throws BufferException
AbstractBufferBuffer.size.
setSize in class AbstractBufferBufferException
protected void initialize(int first)
throws BufferException
BufferException
public void setProperty(String key,
String value)
throws BufferException
AbstractBufferBuffer.size property.
setProperty in interface BuffersetProperty in class AbstractBufferBufferExceptionpublic void handle(Object message)
Bufferread().
handle in interface Bufferhandle in interface Consumerhandle in class AbstractBuffermessage - The message.
protected abstract boolean shouldHandle(Object message)
throws Exception
Exception
public Object[] read()
throws BufferException
read in interface Bufferread in class AbstractBufferBufferException - If a message could not be handled for some reason.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||