All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class iBus.layers.NAK

java.lang.Object
   |
   +----iBus.ProtocolObject
           |
           +----iBus.layers.NAK

public class NAK
extends ProtocolObject
implements Runnable

NAK: Fully reliable, negative acknowledgements (NAK) multicast layer.

NAK uses immediate, receiver-initiated, NAK-based, unicast loss notification combined with originator based unicast and multicast retransmission (selectable). The NAK protocol is similar to RAMP (RFC 1485).

NAK does not implement fifo ordering nor the filtering of duplicated messages. This is accomplished by a FIFO layer atop of NAK. NAK only makes sure that each message is received at least once, without caring about duplicates and messages that are out of order. NAK also does not implement failure detection as this is handled by a membership layer beneath NAK (REACH, for example).

NAK is designed for intranets. It assumes low bit-error rates and that packet loss is mostly a result of receiver buffer overflow. (For multicasting over the MBONE a nak layer similar to RTP (RFC 1889) is more appropriate. RTP employs delayed, receiver-initiated, multicast error notification. NAK can be extended in this respect, though).

NAK is fully reliable, i.e., it is both sender and receiver reliable. For that it takes advantage of the membership information which is delivered to it by a membership layer beneath, in the form of iBus.View events. When a membership layer is present, NAK synchronizes with the receivers before it flushes its internal retransmission cache. This increases the reliability of the protocol considerably.

NAK relies only on negative acknowledgements while transmitting an epoch of messages. An epoch has a fixed size of typically 100 to 1000 messages. At the end of an epoch, NAK waits until it has received a positive acknowledgement from each surviving receiver. After this it flushes its message retransmission cache and proceeds with sending the next epoch. In the ideal case there is only one round of positive acknowledgements for every epoch-size of messages.

NAK can be used without a membership layer beneath. However, in such situation the protocol is only semi-reliable (``best-effort'') since NAK has no way of synchronizing with its receivers before flushing an internal message retransmission cache.

PARAMETERS:

POSITION IN STACK:

LIMITS:

DESIGN:

EVENTS PRODUCED:

EVENTS HANDLED:

EVENTS CONSUMED:

THREADS:


Constructor Index

 o NAK()
Create a NAK object by initializing the ProtocolObject base class

Method Index

 o dnInit()
Initialize the protocol object after the protocol stack has been created.
 o dnPush(iBusURL, MessageEvent)
Called by the object above to send a message to a channel by multicast or unicast communication, depending on the channel URL:
 o dnRegisterTalker(iBusURL)
Called by the object above or by an iBus application to register as a talker with a channel.
 o dnSubscribe(iBusURL)
Subscribe to a channel.
 o dnTerminate()
Terminate any threads in the protocol object.
 o dnUnregisterTalker(iBusURL)
Called by the object above or by an iBus application to unregister as a talker of a certain channel.
 o dnUnsubscribe(iBusURL)
Unsubscribe from a channel.
 o expectedInitialMsgs()
Returns the number of initial messages that a new listener may re-request.
 o getChannelInfos()
Get the channelInfos_ table.
 o getEpochSize()
Get the epoch size property.
 o getHBIntarval()
Get the hb interval property.
 o getIdleIntarval()
Get the idle interval property.
 o getRetrInterval()
Get the retry interval property.
 o getRetrInterval(int)
Set the retry interval property.
 o getSendDelay()
Get the send delay property.
 o hbThread()
Heartbeat thread.
 o isExpectInitialMessages()
Check the ExpectInitialMessages property.
 o isFlowControl()
Check whether we have to perform flow control.
 o isStatistics()
Check the value of the statistics property.
 o run()
NAK thread.
 o setExpectInitialMessages(boolean)
Set the send delay property.
 o setHBInterval(int)
Set the epoch size property.
 o setIdleInterval(int)
Set the idle interval property.
 o setSendDelay(int)
Set the send delay property.
 o setStatistics(boolean)
Set the statistics property.
 o upHandleEvent(Event)
Called by the protocol object beneath to pass an event up to me.

Constructors

 o NAK
 public NAK()
Create a NAK object by initializing the ProtocolObject base class

Methods

 o 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.

Overrides:
dnInit in class ProtocolObject
 o dnTerminate
 public void dnTerminate()
Terminate any threads in the protocol object. The object is unusable afterwards.

Overrides:
dnTerminate in class ProtocolObject
 o dnSubscribe
 public synchronized void dnSubscribe(iBusURL channel) throws AlreadySubscribed, CommException
Subscribe to a channel. This creates an IncomingChecker object and puts it into incomingCheckers_.

Parameters:
channel - the iBus channel to subscribe to
Throws: AlreadySubscribed
if this stack has already subscribed to the channel
Throws: CommException
in case of a communication failure
Overrides:
dnSubscribe in class ProtocolObject
 o dnUnsubscribe
 public synchronized void dnUnsubscribe(iBusURL channel) throws NotSubscribed, CommException
Unsubscribe from a channel. Destroys the IncomingChecker for that channel.

Parameters:
channel - the iBus channel to unsubscribe from
Throws: NotSubscribed
if this stack is not subscribed to the channel
Throws: CommException
in case of a communication failure
Overrides:
dnUnsubscribe in class ProtocolObject
 o dnRegisterTalker
 public synchronized void dnRegisterTalker(iBusURL channel) throws AlreadyRegistered, CommException
Called by the object above or by an iBus application to register as a talker with a channel. dnRegisterTalker checks whether a matching ChannelInfo exists in channelInfos_. If yes, clear its obsolete flag. If not, create and add a new ChannelInfo object.

Parameters:
channel - the channel to register with
Throws: AlreadyRegistered
if this stack is already registered with the channel
Throws: CommException
in case of a communication error
Overrides:
dnRegisterTalker in class ProtocolObject
 o dnUnregisterTalker
 public void dnUnregisterTalker(iBusURL channel) throws NotRegistered, CommException
Called by the object above or by an iBus application to unregister as a talker of a certain channel. Gets the ChannelInfo object for the channel. If there are no messages in ChannelInfo.outgoing_ then we remove the ChannelInfo. Otherwise we tag it as obsolete such that it will be removed as soon as its message cache is empty.

Parameters:
channel - the channel to unregister from
Throws: NotRegistered
if this stack is not registered with the channel
Throws: CommException
in case of a communication error
Overrides:
dnUnregisterTalker in class ProtocolObject
 o dnPush
 public void dnPush(iBusURL channel,
                    MessageEvent msg) throws CommException, NotRegistered
Called by the object above to send a message to a channel by multicast or unicast communication, depending on the channel URL:

Parameters:
channel - the destination channel of the posting
msg - the message to be sent
Throws: CommException
on communication failure
Throws: NotRegistered
in case registerTalker was not called for the channel
Overrides:
dnPush in class ProtocolObject
 o run
 public void run()
NAK thread.

See Also:
langRunnable
 o hbThread
 protected void hbThread()
Heartbeat thread. Iterate over all ChannelInfo objects. Check time last message was sent. Deliver idle heartbeat on timeout. If dnUnregisterCalled was called then tag the heartbeat with an epoch-end flag.

 o expectedInitialMsgs
 protected int expectedInitialMsgs()
Returns the number of initial messages that a new listener may re-request.

Returns:
the number of initial messages that a new listener may re-request
 o upHandleEvent
 public void upHandleEvent(Event event)
Called by the protocol object beneath to pass an event up to me. An event can be the arrival of a posting, the detection of a failure, an acknowledgement, etc.

Parameters:
event - the event object to process
Overrides:
upHandleEvent in class ProtocolObject
 o getEpochSize
 public int getEpochSize()
Get the epoch size property.

Returns:
the epoch size property
 o getHBIntarval
 public int getHBIntarval()
Get the hb interval property.

Returns:
the hb interval property
 o setHBInterval
 public void setHBInterval(int hi)
Set the epoch size property.

Parameters:
hi - the new value of the epoch size property
 o getIdleIntarval
 public int getIdleIntarval()
Get the idle interval property.

Returns:
the idle interval property
 o setIdleInterval
 public void setIdleInterval(int ii)
Set the idle interval property.

Parameters:
ii - the new value of the idle interval property
 o getSendDelay
 public int getSendDelay()
Get the send delay property.

Returns:
the send delay property
 o setSendDelay
 public void setSendDelay(int sd)
Set the send delay property.

Parameters:
sd - the new value of the send delay property
 o setStatistics
 public void setStatistics(boolean on)
Set the statistics property.

Parameters:
on - the new value of the statistics property
 o isStatistics
 public boolean isStatistics()
Check the value of the statistics property.

Returns:
the value of the statistics property
 o isExpectInitialMessages
 public boolean isExpectInitialMessages()
Check the ExpectInitialMessages property.

Returns:
the ExpectInitialMessages property.
 o setExpectInitialMessages
 public void setExpectInitialMessages(boolean on)
Set the send delay property.

Parameters:
on - the new value of the ExpectInitialMessages property. If the property is set, then the first maxExpectedInitialMsgs_ messages are always retransmitted. This is useful for applications thst start, push a posting and terminate immediately. If ExpectInitialMessages is false then the posting would not be retranmsitted if it gets lots on the network.
 o getRetrInterval
 public int getRetrInterval()
Get the retry interval property.

Returns:
the retry interval property
 o getRetrInterval
 public void getRetrInterval(int ri)
Set the retry interval property.

Parameters:
ri - the retry interval property
 o isFlowControl
 public boolean isFlowControl()
Check whether we have to perform flow control.

Returns:
whether we have to perform flow control
 o getChannelInfos
 protected Hashtable getChannelInfos()
Get the channelInfos_ table.

Returns:
the channelInfos_ table

All Packages  Class Hierarchy  This Package  Previous  Next  Index