org.objectweb.dream.queue.keyed
Class BufferAscendingSequenceNumberKeyedAddKeyedRemoveImpl

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

public class BufferAscendingSequenceNumberKeyedAddKeyedRemoveImpl
extends AbstractBufferKeyedAddKeyedRemoveImpl
implements BufferAttributeControllerAscendingSequenceNumberKeyedAdd

This buffer stores incoming messages according to

The doRemove(Object)method removes the last message in sequence for the specified key.

For each key, when there is a gap upon adding a message, missing sequence numbers are made known using the MissingSequenceNumberKeyBased interface. For instance, a component can use this interface to issue retransmission requests.


Field Summary
protected  MessageManager messageManagerItf
           
protected  MissingSequenceNumberKeyBased missingSequenceNumberKeyBasedItf
           
 
Fields inherited from class org.objectweb.dream.queue.keyed.AbstractBufferKeyedAddKeyedRemoveImpl
availableMessagesCount, CLIENT_INTERFACE_NAMES, lock, maxCapacity, 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
BufferAscendingSequenceNumberKeyedAddKeyedRemoveImpl()
           
 
Method Summary
 void bindFc(String clientItfName, Object serverItf)
           
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.
 Object[] getKeys()
          Returns an array containing the keys that are used in the buffer.
 long getLastInSequence(Object key)
          Returns the sequence number of the last delivered message for the given key.
 String getSortingChunkName()
          Returns the name of the chunk to be used to sort messages.
protected  boolean hasAvailableMessage(Object key)
          Checks whether there is a message available to get or remove.
 String[] listFc()
           
 void setLastInSequence(Object key, long lastInSequence)
          Sets the sequence number of the last delivered message for the given key.
 void setSortingChunkName(String name)
          Sets the name of the chunk to be used to sort messages.
 
Methods inherited from class org.objectweb.dream.queue.keyed.AbstractBufferKeyedAddKeyedRemoveImpl
add, availableSpace, canAdd, get, getCurrentSize, getMaxCapacity, incrementAvailableMessagesCount, incrementStoredMessagesCount, 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
 
Methods inherited from interface org.objectweb.dream.queue.BufferAttributeController
getCurrentSize, getMaxCapacity, setMaxCapacity
 

Field Detail

missingSequenceNumberKeyBasedItf

protected MissingSequenceNumberKeyBased missingSequenceNumberKeyBasedItf

messageManagerItf

protected MessageManager messageManagerItf
Constructor Detail

BufferAscendingSequenceNumberKeyedAddKeyedRemoveImpl

public BufferAscendingSequenceNumberKeyedAddKeyedRemoveImpl()
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.
See Also:
AbstractBufferKeyedAddKeyedRemoveImpl.doAdd(Message, Object)

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.
See Also:
AbstractBufferKeyedAddKeyedRemoveImpl.doRemove(Object)

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.
See Also:
AbstractBufferKeyedAddKeyedRemoveImpl.doRemoveAll()

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.
See Also:
AbstractBufferKeyedAddKeyedRemoveImpl.doGet(Object)

hasAvailableMessage

protected boolean hasAvailableMessage(Object key)
Description copied from class: AbstractBufferKeyedAddKeyedRemoveImpl
Checks whether there is a message available to get or remove.

Overrides:
hasAvailableMessage in class AbstractBufferKeyedAddKeyedRemoveImpl
Returns:
true if there is an available message.
See Also:
AbstractBufferKeyedAddKeyedRemoveImpl.hasAvailableMessage(Object)

getSortingChunkName

public String getSortingChunkName()
Description copied from interface: BufferAttributeControllerSorted
Returns the name of the chunk to be used to sort messages.

Specified by:
getSortingChunkName in interface BufferAttributeControllerSorted
Returns:
the name of the chunk to be used to sort messages.
See Also:
BufferAttributeControllerSorted.getSortingChunkName()

setSortingChunkName

public void setSortingChunkName(String name)
Description copied from interface: BufferAttributeControllerSorted
Sets the name of the chunk to be used to sort messages.

Specified by:
setSortingChunkName in interface BufferAttributeControllerSorted
Parameters:
name - the name of the chunk to be used to sort messages.
See Also:
BufferAttributeControllerSorted.setSortingChunkName(java.lang.String)

getKeys

public Object[] getKeys()
Description copied from interface: BufferAttributeControllerKeyed
Returns an array containing the keys that are used in the buffer.

Specified by:
getKeys in interface BufferAttributeControllerKeyed
Returns:
an array containing the keys that are used in the buffer.
See Also:
BufferAttributeControllerKeyed.getKeys()

getLastInSequence

public long getLastInSequence(Object key)
                       throws InterruptedException
Description copied from interface: BufferAttributeControllerAscendingSequenceNumberKeyedAdd
Returns the sequence number of the last delivered message for the given key.

Specified by:
getLastInSequence in interface BufferAttributeControllerAscendingSequenceNumberKeyedAdd
Parameters:
key - the key for which the last sequence number in sequence must be returned.
Returns:
the sequence number of the last delivered message for the given key.
Throws:
InterruptedException - if it is interrupted while waiting for the mutex to be acquired.
See Also:
BufferAttributeControllerAscendingSequenceNumberKeyedAdd.getLastInSequence(Object)

setLastInSequence

public void setLastInSequence(Object key,
                              long lastInSequence)
                       throws InterruptedException
Description copied from interface: BufferAttributeControllerAscendingSequenceNumberKeyedAdd
Sets the sequence number of the last delivered message for the given key.

Specified by:
setLastInSequence in interface BufferAttributeControllerAscendingSequenceNumberKeyedAdd
Parameters:
key - the key for which the last sequence number in sequence must be set.
lastInSequence - the sequence number to be set.
Throws:
InterruptedException - if it is interrupted while waiting for the mutex to be acquired.
See Also:
BufferAttributeControllerAscendingSequenceNumberKeyedAdd.setLastInSequence(Object,long)

bindFc

public void bindFc(String clientItfName,
                   Object serverItf)
            throws NoSuchInterfaceException,
                   IllegalBindingException,
                   IllegalLifeCycleException
Specified by:
bindFc in interface BindingController
Overrides:
bindFc in class AbstractBufferKeyedAddKeyedRemoveImpl
Throws:
NoSuchInterfaceException
IllegalBindingException
IllegalLifeCycleException
See Also:
BindingController.bindFc(java.lang.String, java.lang.Object)

listFc

public String[] listFc()
Specified by:
listFc in interface BindingController
Overrides:
listFc in class AbstractBufferKeyedAddKeyedRemoveImpl
See Also:
BindingController.listFc()


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