org.jgroups.protocols

Class UNICAST

public class UNICAST extends Protocol implements AckSenderWindow.RetransmitCommand

Reliable unicast layer. Uses acknowledgement scheme similar to TCP to provide lossless transmission of unicast messages (for reliable multicast see NAKACK layer). When a message is sent to a peer for the first time, we add the pair to the hashtable (peer address is the key). All messages sent to that peer will be added to hashtable.peer_addr.sent_msgs. When we receive a message from a peer for the first time, another entry will be created and added to the hashtable (unless already existing). Msgs will then be added to hashtable.peer_addr.received_msgs.

This layer is used to reliably transmit point-to-point messages, that is, either messages sent to a single receiver (vs. messages multicast to a group) or for example replies to a multicast message. The sender uses an AckSenderWindow which retransmits messages for which it hasn't received an ACK, the receiver uses AckReceiverWindow which keeps track of the lowest seqno received so far, and keeps messages in order.

Messages in both AckSenderWindows and AckReceiverWindows will be removed. A message will be removed from AckSenderWindow when an ACK has been received for it and messages will be removed from AckReceiverWindow whenever a message is received: the new message is added and then we try to remove as many messages as possible (until we stop at a gap, or there are no more messages).

Author: Bela Ban

Nested Class Summary
static classUNICAST.UnicastHeader
Method Summary
voiddown(Event evt)
MapdumpStats()
StringgetLocalAddress()
StringgetMembers()
StringgetName()
All protocol names have to be unique !
longgetNumAcksReceived()
longgetNumAcksSent()
longgetNumberOfRetransmitRequestsReceived()
intgetNumberOfUnackedMessages()
The number of messages in all Entry.sent_msgs tables (haven't received an ACK yet)
longgetNumBytesReceived()
longgetNumBytesSent()
longgetNumMessagesReceived()
longgetNumMessagesSent()
StringprintConnections()
voidresetStats()
voidretransmit(long seqno, Message msg)
Called by AckSenderWindow to resend messages for which no ACK has been received yet
booleansetProperties(Properties props)
voidstart()
voidstop()
voidup(Event evt)

Method Detail

down

public void down(Event evt)

dumpStats

public Map dumpStats()

getLocalAddress

public String getLocalAddress()

getMembers

public String getMembers()

getName

public String getName()
All protocol names have to be unique !

getNumAcksReceived

public long getNumAcksReceived()

getNumAcksSent

public long getNumAcksSent()

getNumberOfRetransmitRequestsReceived

public long getNumberOfRetransmitRequestsReceived()

getNumberOfUnackedMessages

public int getNumberOfUnackedMessages()
The number of messages in all Entry.sent_msgs tables (haven't received an ACK yet)

getNumBytesReceived

public long getNumBytesReceived()

getNumBytesSent

public long getNumBytesSent()

getNumMessagesReceived

public long getNumMessagesReceived()

getNumMessagesSent

public long getNumMessagesSent()

printConnections

public String printConnections()

resetStats

public void resetStats()

retransmit

public void retransmit(long seqno, Message msg)
Called by AckSenderWindow to resend messages for which no ACK has been received yet

setProperties

public boolean setProperties(Properties props)

start

public void start()

stop

public void stop()

up

public void up(Event evt)
Copyright ? 1998-2005 Bela Ban. All Rights Reserved.