org.objectweb.dream.queue.keyed
Interface KeyedBufferAdd

All Known Implementing Classes:
AbstractBufferKeyedAddKeyedRemoveImpl, BufferAscendingKeyKeyChunkAddDoubleKeyedRemoveImpl, BufferAscendingSequenceNumberKeyedAddKeyedRemoveImpl, BufferKeyedAddKeyedRemoveImpl

public interface KeyedBufferAdd

This interface defines methods that must be implemented by a buffer to allow components to add messages into it, each message being associated with a key. Such an interface is used by producers of messages.

Note: buffer implementations MUST BE thread-safe .


Field Summary
static String ITF_NAME
          The commonly used name to refer to an interface with this signature.
 
Method Summary
 void add(Message message, Object key)
          Adds the specified message to the buffer, associated with the specified key object.
 boolean tryAdd(Message message, Object key)
          Adds the specified message to the buffer, associated with the specified key object.
 

Field Detail

ITF_NAME

static final String ITF_NAME
The commonly used name to refer to an interface with this signature.

See Also:
Constant Field Values
Method Detail

add

void add(Message message,
         Object key)
         throws InterruptedException
Adds the specified message to the buffer, associated with the specified key object. This method blocks while there is not enough space available, and while this buffer contains a message already associated with the specified key.

Buffers may place limitations on what elements may be added to this buffer. In particular, some buffers require that messages contain particular chunks.

Parameters:
message - the message to be added; never null.
key - the key that is associated with the message to be added; never null.
Throws:
InterruptedException - if it is interrupted while waiting for a message to be removed.
See Also:
BufferAdd.add(Message)

tryAdd

boolean tryAdd(Message message,
               Object key)
Adds the specified message to the buffer, associated with the specified key object. If the message cannot be added (due to space limitation, or if a message is already associated with the specified key), the message is not added.

Buffers may place limitations on what elements may be added to this buffer. In particular, some buffers require that messages contain particular chunks.

Parameters:
message - the message to be added; never null.
key - the key that is associated with the message to be added; never null.
Returns:
true if the message has been added.
See Also:
BufferAdd.tryAdd(Message)


Copyright © 2003, 2005 - INRIA Rhone-Alpes - All Rights Reserved.