|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.dream.AbstractComponent
org.objectweb.dream.queue.AbstractBufferImpl
org.objectweb.dream.queue.BufferMatchingImpl
public class BufferMatchingImpl
A buffer in which stored messages are available to get
or remove
only if they are accepted
by the message matcher
bound to this component.
get()
calls and/or
remove()
calls are blocked waiting for available messages, and the
message matcher criteria modification would let them return messages, the
blocked calls can be unblocked by calling AbstractBufferImpl.tryGet()
after the message
matcher has been modified.
Field Summary | |
---|---|
protected static String[] |
CLIENT_INTERFACE_NAMES
The names of client interfaces. |
protected int |
gettersCount
The number of calls that are waiting to get (not remove) matching messages. |
protected MessageMatcher |
messageMatcherItf
The message matcher that is used to select the messages that can be returned by calls to get() , AbstractBufferImpl.tryGet() , remove() ,
AbstractBufferImpl.tryRemove() and AbstractBufferImpl.removeAll() . |
protected LinkedList<Message> |
messages
The messages stored in this buffer, in adding order (FIFO). |
protected LinkedList<Message> |
messagesToBeReturned
Messages that have matched messageMatcherItf and that are ready to
be returned. |
protected int |
removersCount
The number of calls that are waiting to remove matching messages. |
Fields inherited from class org.objectweb.dream.queue.AbstractBufferImpl |
---|
availableMessagesCount, 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.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 | |
---|---|
BufferMatchingImpl()
|
Method Summary | |
---|---|
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. |
Message |
get()
Gets a message from the buffer. |
protected boolean |
hasAvailableMessage()
Checks whether there is a message available to get or remove. |
String[] |
listFc()
|
Message |
remove()
Removes a message from the buffer. |
protected void |
searchMessagesToBeReturned()
If there are waiting removers (i.e., if
or if ), iterate over
the received messages , and test each message by calling
MessageMatcher.acceptMessage(Message) using
the bound matcher , until at most enough matching
messages for waiting removers and getters have been found. |
Methods inherited from class org.objectweb.dream.queue.AbstractBufferImpl |
---|
add, availableSpace, canAdd, getCurrentSize, getMaxCapacity, incrementAvailableMessagesCount, incrementStoredMessagesCount, 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 |
Field Detail |
---|
protected static final String[] CLIENT_INTERFACE_NAMES
protected MessageMatcher messageMatcherItf
get()
, AbstractBufferImpl.tryGet()
, remove()
,
AbstractBufferImpl.tryRemove()
and AbstractBufferImpl.removeAll()
. This is the client
interface named "message-matcher".
protected LinkedList<Message> messages
protected LinkedList<Message> messagesToBeReturned
messageMatcherItf
and that are ready to
be returned. The messages are in adding order (FIFO).
protected int removersCount
protected int gettersCount
Constructor Detail |
---|
public BufferMatchingImpl()
Method Detail |
---|
protected void doAdd(Message message)
AbstractBufferImpl
AbstractBufferImpl.add(org.objectweb.dream.message.Message)
method. The lock
has been acquired when this
method is called.
doAdd
in class AbstractBufferImpl
message
- the message to be added.public Message remove() throws InterruptedException
BufferRemove
remove
in interface BufferRemove
remove
in class AbstractBufferImpl
null
.
InterruptedException
- if it is interrupted while waiting for a
message to be added.BufferRemove.remove()
protected Message doRemove()
AbstractBufferImpl
AbstractBufferImpl.remove()
method. The lock
has been acquired when this
method is called.
doRemove
in class AbstractBufferImpl
protected Message doRemoveAll()
AbstractBufferImpl
lock
has
been acquired when this method is called.
doRemoveAll
in class AbstractBufferImpl
public Message get() throws InterruptedException
BufferRemove
get
in interface BufferRemove
get
in class AbstractBufferImpl
null
.
InterruptedException
- if it is interrupted while waiting for a
message to be added.BufferRemove.get()
protected Message doGet()
AbstractBufferImpl
AbstractBufferImpl.get()
method. The lock
has been acquired when this method is
called.
doGet
in class AbstractBufferImpl
protected boolean hasAvailableMessage()
AbstractBufferImpl
hasAvailableMessage
in class AbstractBufferImpl
true
if there is an available message.protected void searchMessagesToBeReturned()
removersCount
> 0
or if gettersCount
> 0
), iterate over
the received messages
, and test each message by calling
MessageMatcher.acceptMessage(Message)
using
the bound matcher
, until at most enough matching
messages for waiting removers and getters have been found. The matching
messages are put in the same order into messagesToBeReturned
,
then removers are notified. The lock
has been acquired when
this method is called.
public String[] listFc()
listFc
in interface BindingController
listFc
in class AbstractBufferImpl
BindingController.listFc()
public void bindFc(String clientItfName, Object serverItf) throws NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException
bindFc
in interface BindingController
bindFc
in class AbstractBufferImpl
NoSuchInterfaceException
IllegalBindingException
IllegalLifeCycleException
BindingController.listFc()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |