org.objectweb.tribe.channel
Class ReceiveBuffer

java.lang.Object
  extended byorg.objectweb.tribe.channel.ReceiveBuffer

public class ReceiveBuffer
extends java.lang.Object

This class defines a ReceiveBuffer which behaves as a FIFO buffer.

Version:
1.0
Author:
Emmanuel Cecchet

Constructor Summary
ReceiveBuffer(java.lang.Object bufferKey)
          Creates a new ReceiveBuffer that collects messages sent to the specified destination key.
 
Method Summary
 void addMessage(java.lang.Object message)
          Adds a new message to the buffer.
 java.lang.Object getBufferKey()
          Returns the destination key this buffer is interested in.
 ChannelMessage getMessage()
          Get the first message from the buffer.
 boolean isEmpty()
          Returns true if the buffer is empty.
 java.lang.Object removeMessage()
          Removes the first message from the buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReceiveBuffer

public ReceiveBuffer(java.lang.Object bufferKey)
Creates a new ReceiveBuffer that collects messages sent to the specified destination key.

Parameters:
bufferKey - message destination key.
Method Detail

getBufferKey

public java.lang.Object getBufferKey()
Returns the destination key this buffer is interested in.

Returns:
Returns the buffer destination key.

addMessage

public void addMessage(java.lang.Object message)
Adds a new message to the buffer.

Parameters:
message - Message to add

getMessage

public ChannelMessage getMessage()
                          throws EmptyBufferException
Get the first message from the buffer. This method blocks until a message is available from the buffer.

Returns:
the first ChannelMessage
Throws:
EmptyBufferException - if an error occurs

removeMessage

public java.lang.Object removeMessage()
                               throws EmptyBufferException
Removes the first message from the buffer.

Returns:
the first message from the queue
Throws:
EmptyBufferException - if the buffer is empty

isEmpty

public boolean isEmpty()
Returns true if the buffer is empty.

Returns:
true if the buffer is empty.


Copyright © 2004 - ObjectWeb Consortium - All Rights Reserved.