org.objectweb.dream.queue.keyed
Class BufferKeyedAddKeyedRemoveImpl

java.lang.Object
  extended by org.objectweb.dream.AbstractComponent
      extended by org.objectweb.dream.queue.keyed.AbstractBufferKeyedAddKeyedRemoveImpl
          extended by org.objectweb.dream.queue.keyed.BufferKeyedAddKeyedRemoveImpl
All Implemented Interfaces:
ContextualBindingController, NeedAsyncStartController, PrepareStopLifeCycleController, Loggable, BufferAttributeController, KeyedBufferAdd, KeyedBufferRemove, AttributeController, BindingController, LifeCycleController

public class BufferKeyedAddKeyedRemoveImpl
extends AbstractBufferKeyedAddKeyedRemoveImpl

Buffer that uses keys to sort messages. The key corresponding to a message is explicitely passed as a parameter, when adding the message using the AbstractBufferKeyedAddKeyedRemoveImpl.add(Message, Object) method. The doRemove(Object) method removes the message with the specified key. If no key is specified in the doRemove() method, this latter returns the message with the highest key.

Note: Keys must implement the Comparableinterface.


Field Summary
 
Fields inherited from class org.objectweb.dream.queue.keyed.AbstractBufferKeyedAddKeyedRemoveImpl
availableMessagesCount, CLIENT_INTERFACE_NAMES, lock, maxCapacity, messageManagerItf, storedMessagesCount
 
Fields inherited from class org.objectweb.dream.AbstractComponent
bindingLogger, fcNeedAsyncStart, fcState, lifeCycleLogger, logger, weaveableC
 
Fields inherited from interface org.objectweb.dream.queue.keyed.KeyedBufferAdd
ITF_NAME
 
Fields inherited from interface org.objectweb.dream.queue.keyed.KeyedBufferRemove
ITF_NAME
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
BufferKeyedAddKeyedRemoveImpl()
           
 
Method Summary
protected  void doAdd(Message message, Object key)
          Adds a message to the buffer.
protected  Message doGet(Object key)
          Gets a message from the buffer.
protected  Message doRemove(Object key)
          Removes a message from the buffer.
protected  Message doRemoveAll()
          Removes all the messages stored into the buffer.
 
Methods inherited from class org.objectweb.dream.queue.keyed.AbstractBufferKeyedAddKeyedRemoveImpl
add, availableSpace, bindFc, canAdd, get, getCurrentSize, getMaxCapacity, hasAvailableMessage, incrementAvailableMessagesCount, incrementStoredMessagesCount, listFc, remove, removeAll, setMaxCapacity, tryAdd, tryGet, tryRemove
 
Methods inherited from class org.objectweb.dream.AbstractComponent
beforeFirstStart, bindFc, getFcNeedAsyncStart, getFcState, initComponent, lookupFc, prepareStopFc, setLogger, startFc, stopFc, unbindFc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferKeyedAddKeyedRemoveImpl

public BufferKeyedAddKeyedRemoveImpl()
Method Detail

doAdd

protected void doAdd(Message message,
                     Object key)
Description copied from class: AbstractBufferKeyedAddKeyedRemoveImpl
Adds a message to the buffer. This method should not check if there is enough available space provided it has already been done in the AbstractBufferKeyedAddKeyedRemoveImpl.add(org.objectweb.dream.message.Message, java.lang.Object)method. The lockhas been acquired when this method is called.

Specified by:
doAdd in class AbstractBufferKeyedAddKeyedRemoveImpl
Parameters:
message - the message to be added.

doGet

protected Message doGet(Object key)
Description copied from class: AbstractBufferKeyedAddKeyedRemoveImpl
Gets a message from the buffer. This method should not check if there is a message available provided it has already been done in the AbstractBufferKeyedAddKeyedRemoveImpl.get(java.lang.Object) method. The lockhas been acquired when this method is called.

Specified by:
doGet in class AbstractBufferKeyedAddKeyedRemoveImpl
Returns:
a message.

doRemove

protected Message doRemove(Object key)
Description copied from class: AbstractBufferKeyedAddKeyedRemoveImpl
Removes a message from the buffer. This method should not check if there is a message available provided it has already been done in the AbstractBufferKeyedAddKeyedRemoveImpl.remove(java.lang.Object)method. The lockhas been acquired when this method is called.

Specified by:
doRemove in class AbstractBufferKeyedAddKeyedRemoveImpl
Returns:
a message.

doRemoveAll

protected Message doRemoveAll()
Description copied from class: AbstractBufferKeyedAddKeyedRemoveImpl
Removes all the messages stored into the buffer. The lockhas been acquired when this method is called.

Specified by:
doRemoveAll in class AbstractBufferKeyedAddKeyedRemoveImpl
Returns:
an aggregated message.


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