org.objectweb.dream.queue
Class BufferKeyMutexSortedImpl

java.lang.Object
  extended by org.objectweb.dream.AbstractComponent
      extended by org.objectweb.dream.queue.AbstractBufferImpl
          extended by org.objectweb.dream.queue.BufferKeyMutexSortedImpl
All Implemented Interfaces:
ContextualBindingController, NeedAsyncStartController, PrepareStopLifeCycleController, Loggable, BufferAdd, BufferAttributeController, BufferRemove, UnlockKey, AttributeController, BindingController, LifeCycleController

public class BufferKeyMutexSortedImpl
extends AbstractBufferImpl
implements UnlockKey

This buffer sorts messages using a key provided by a MessageKeyManager. For a given key, messages are returned in a FIFO order, and in mutual exclusion.


Nested Class Summary
static class BufferKeyMutexSortedImpl.ListElem
          Object list elements.
static class BufferKeyMutexSortedImpl.MessageList
          Object list
 
Field Summary
 
Fields inherited from class org.objectweb.dream.queue.AbstractBufferImpl
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.UnlockKey
ITF_NAME
 
Fields inherited from interface org.objectweb.dream.queue.BufferAdd
ITF_NAME
 
Fields inherited from interface org.objectweb.dream.queue.BufferRemove
ITF_NAME
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
BufferKeyMutexSortedImpl()
           
 
Method Summary
protected  void addAtHead(BufferKeyMutexSortedImpl.MessageList list)
           
protected  void addMessageAtLast(BufferKeyMutexSortedImpl.MessageList messageList, Message message)
           
 void bindFc(String clientItfName, Object serverItf)
           
protected  void doAdd(Message message)
          Adds a message to the buffer.
protected  Message doGet()
          Gets a message from the buffer.
protected  Message doRemove()
          Removes a message from the buffer.
protected  Message doRemoveAll()
          Removes all the messages stored into the buffer.
 String[] listFc()
           
protected  Message removeMessageAtFirst(BufferKeyMutexSortedImpl.MessageList messageList)
           
protected  BufferKeyMutexSortedImpl.MessageList removeTail()
           
 void unlockKey()
          Unlock the key of the calling thread.
 
Methods inherited from class org.objectweb.dream.queue.AbstractBufferImpl
add, availableSpace, canAdd, get, getCurrentSize, getMaxCapacity, hasAvailableMessage, 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
 

Constructor Detail

BufferKeyMutexSortedImpl

public BufferKeyMutexSortedImpl()
Method Detail

doAdd

protected void doAdd(Message message)
Description copied from class: AbstractBufferImpl
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 AbstractBufferImpl.add(org.objectweb.dream.message.Message)method. The lockhas been acquired when this method is called.

Specified by:
doAdd in class AbstractBufferImpl
Parameters:
message - the message to be added.
See Also:
AbstractBufferImpl.doAdd(Message)

doRemove

protected Message doRemove()
Description copied from class: AbstractBufferImpl
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 AbstractBufferImpl.remove()method. The lockhas been acquired when this method is called.

Specified by:
doRemove in class AbstractBufferImpl
Returns:
a message.
See Also:
AbstractBufferImpl.doRemove()

doRemoveAll

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

Specified by:
doRemoveAll in class AbstractBufferImpl
Returns:
an aggregated message.
See Also:
AbstractBufferImpl.doRemoveAll()

doGet

protected Message doGet()
Description copied from class: AbstractBufferImpl
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 AbstractBufferImpl.get() method. The lockhas been acquired when this method is called.

Specified by:
doGet in class AbstractBufferImpl
Returns:
a message.
See Also:
AbstractBufferImpl.doGet()

unlockKey

public void unlockKey()
Description copied from interface: UnlockKey
Unlock the key of the calling thread.

Specified by:
unlockKey in interface UnlockKey
See Also:
UnlockKey.unlockKey()

bindFc

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

listFc

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

addAtHead

protected void addAtHead(BufferKeyMutexSortedImpl.MessageList list)

removeTail

protected BufferKeyMutexSortedImpl.MessageList removeTail()

addMessageAtLast

protected void addMessageAtLast(BufferKeyMutexSortedImpl.MessageList messageList,
                                Message message)

removeMessageAtFirst

protected Message removeMessageAtFirst(BufferKeyMutexSortedImpl.MessageList messageList)


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