org.objectweb.dream.queue.keyed
Interface DoubleKeyedBufferRemove

All Known Implementing Classes:
BufferAscendingKeyKeyChunkAddDoubleKeyedRemoveImpl

public interface DoubleKeyedBufferRemove

This interface defines methods that must be implemented by a buffer to allow components to get or delete messages from it, according to two keys associated with each message. Such an interface is used by consumers of messages.

Note 1: all the messages that are stored in a buffer are not always available for removal (e.g. when the buffer implements an ordering policy).

Note 2: 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
 Message get(Object key1, Object key2)
          Gets the message from the buffer that is associated with the specified keys.
 Message remove(Object key1, Object key2)
          Removes the message from the buffer that is associated with the specified keys.
 Message removeAll()
          Removes all the available messages from the buffer.
 Message removeAll(Object key)
          Removes all the available messages from the buffer that maps the specified key.
 Message tryGet(Object key1, Object key2)
          Gets the message from the buffer that is associated with the specified keys.
 Message tryRemove(Object key1, Object key2)
          Removes the message from the buffer that is associated with the specified keys.
 

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

get

Message get(Object key1,
            Object key2)
            throws InterruptedException
Gets the message from the buffer that is associated with the specified keys. This method blocks while no message associated with the specified keys is available.

Parameters:
key1 - the first key that is associated with the message to get; never null.
key2 - the second key that is associated with the message to get; can be null.
Returns:
the message that is associated with the specified key; never null.
Throws:
InterruptedException - if it is interrupted while waiting for a message to be added.
See Also:
BufferRemove.get()

tryGet

Message tryGet(Object key1,
               Object key2)
               throws InterruptedException
Gets the message from the buffer that is associated with the specified keys. This method does not block.

Parameters:
key1 - the first key that is associated with the message to get; never null.
key2 - the second key that is associated with the message to get; can be null.
Returns:
the message that is associated with the specified keys if there is one, null otherwise.
Throws:
InterruptedException - if it is interrupted while waiting for the mutex to be acquired.
See Also:
BufferRemove.tryGet()

remove

Message remove(Object key1,
               Object key2)
               throws InterruptedException
Removes the message from the buffer that is associated with the specified keys. This method blocks while no message associated with the specified keys is available.

Parameters:
key1 - the first key that is associated with the message to get; never null.
key2 - the second key that is associated with the message to get; can be null.
Returns:
the removed message that was associated with the specified keys; never null.
Throws:
InterruptedException - if it is interrupted while waiting for a message to be added.
See Also:
BufferRemove.remove()

tryRemove

Message tryRemove(Object key1,
                  Object key2)
Removes the message from the buffer that is associated with the specified keys. This method does not block.

Parameters:
key1 - the first key that is associated with the message to get; never null.
key2 - the second key that is associated with the message to get; can be null.
Returns:
the removed message that was associated with the specified key if there was one, null otherwise.
See Also:
BufferRemove.tryRemove()

removeAll

Message removeAll(Object key)
Removes all the available messages from the buffer that maps the specified key. Messages are returned in an aggregated message. If no message has been removed, this method returns null. This method does not block.

Parameters:
key - the key which messages that are removed must match.
Returns:
an aggregated message containing all the messages available from the buffer, or null if no message was available.
See Also:
BufferRemove.removeAll()

removeAll

Message removeAll()
Removes all the available messages from the buffer. Messages are returned in an aggregated message. If no message has been removed, this method returns null. This method does not block.

Returns:
an aggregated message containing all the messages available from the buffer, or null if no message was available.
See Also:
BufferRemove.removeAll()


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