All Packages Class Hierarchy This Package Previous Next Index
Class iBus.layers.FIFO
java.lang.Object
|
+----iBus.ProtocolObject
|
+----iBus.layers.FIFO
- public class FIFO
- extends ProtocolObject
FIFO: protocol object that implements first-in-first-out ordering
and duplicate elimination
FIFO receives a stream of message events from beneath. It eliminates
any duplicate and orders messages according to their sequence numbers.
FIFO assumes that each message is passed up at least once. It does
not implement any loss recovery protocol as this is handled
by the layers below.
POSITION IN STACK:
-
Typically just above a NAK layer. It assumes that a layer below
handles loss detection and retransmission.
-
FIFO assumes there is a membership layer, such as REACH, beneath.
DESIGN:
-
FIFO maintains a vector of messages per channel/sender combination
it knows about. The vector is used for storing messages that are received
out of order.
This information is encapsulated in a per channel/sender FIFO_SenderInfo
object. FIFO maintains a Hashtable (senders_) of Hashtables of
FIFO_SenderInfo objects. senders_ is referenced by channel URL,
the elements of senders_ are referenced by sender URL.
For each sender, FIFO also maintains the last sequence number that was
passed up in order. This is needed to detect duplicates.
EVENTS PRODUCED:
EVENTS HANDLED:
-
Event.evMessage: orders messages
-
Event.evView: to know when a sender joins or leaves, resp.
EVENTS CONSUMED:
-
Event.evMessage: eliminates duplicated messages
-
FIFO()
- Creates a protocol object and assigns a name to it.
-
dnInit()
- Initialize the protocol object after the protocol stack has been
created.
-
dnSubscribe(iBusURL)
- Called by the object above to subscribe to a channel.
-
dnUnsubscribe(iBusURL)
- Called by the object above or by an iBus application to unsubscribe
from a certain channel.
-
getOutOfOrderHi(iBusURL, iBusURL)
- Returns the outOfOrderHi property for a given channel/sender
combination.
-
upHandleEvent(Event)
- Called by the protocol object beneath to pass an event up to me.
FIFO
public FIFO()
- Creates a protocol object and assigns a name to it.
dnInit
public synchronized void dnInit()
- Initialize the protocol object after the protocol stack has been
created. Also checks that the right parameters were given to the
protocol object.
FIFO_test uses this function to reinitialize the object.
- Overrides:
- dnInit in class ProtocolObject
dnSubscribe
public synchronized void dnSubscribe(iBusURL channel) throws AlreadySubscribed, CommException
- Called by the object above to subscribe to a channel.
allocates a Hashtable of FIFO_SenderInfo objects for that channel.
That Hashtable is put into the senders_ Hashtable.
- Parameters:
- channel - the channel to subscribe to
- Throws: AlreadySubscribed
- if this stack is already
subscribed to the channel
- Throws: CommException
- in case of a communication
error
- Overrides:
- dnSubscribe in class ProtocolObject
dnUnsubscribe
public synchronized void dnUnsubscribe(iBusURL channel) throws NotSubscribed, CommException
- Called by the object above or by an iBus application to unsubscribe
from a certain channel. Deallocates the Hashtable in senders_.
- Parameters:
- channel - the channel to unsubscribe from
- Throws: NotSubscribed
- if this stack is not subscribed
to the channel
- Throws: CommException
- in case of a communication
error
- Overrides:
- dnUnsubscribe in class ProtocolObject
upHandleEvent
public void upHandleEvent(Event event)
- Called by the protocol object beneath to pass an event up to me.
Implements FIFO-ness of message events. Duplicates are discarded.
- Parameters:
- event - determines the type of event
- Overrides:
- upHandleEvent in class ProtocolObject
getOutOfOrderHi
public synchronized long getOutOfOrderHi(iBusURL channel,
iBusURL sender) throws Exception
- Returns the outOfOrderHi property for a given channel/sender
combination. This is needed for the FIFO_test driver.
- Parameters:
- channel - the channel in question
- sender - the sender on the channel
- Returns:
- the outOfOrderHi property for channel/sender
- Throws: Exception
- in case channel/sender does not exist
All Packages Class Hierarchy This Package Previous Next Index