org.jgroups.protocols
Class JOLSR_UNICAST

java.lang.Object
  extended by org.jgroups.stack.Protocol
      extended by org.jgroups.protocols.JOLSR_UNICAST
All Implemented Interfaces:
org.jgroups.stack.AckSenderWindow.RetransmitCommand

public class JOLSR_UNICAST
extends org.jgroups.stack.Protocol
implements org.jgroups.stack.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 class JOLSR_UNICAST.UnicastHeader
           
 
Field Summary
 
Fields inherited from class org.jgroups.stack.Protocol
down_prot, log, props, stack, stats, up_prot
 
Constructor Summary
JOLSR_UNICAST()
           
 
Method Summary
 java.lang.Object down(org.jgroups.Event evt)
           
 java.util.Map<java.lang.String,java.lang.Object> dumpStats()
           
 java.lang.String getLocalAddress()
           
 java.lang.String getMembers()
           
 java.lang.String getName()
          All protocol names have to be unique !
 long getNumAcksReceived()
           
 long getNumAcksSent()
           
 int getNumberOfMessagesInReceiveWindows()
           
 long getNumberOfRetransmitRequestsReceived()
           
 int getNumberOfUnackedMessages()
          The number of messages in all Entry.sent_msgs tables (haven't received an ACK yet)
 long getNumBytesReceived()
           
 long getNumBytesSent()
           
 long getNumMessagesReceived()
           
 long getNumMessagesSent()
           
 java.lang.String getUnackedMessages()
           
 java.lang.String printConnections()
           
 void resetStats()
           
 void retransmit(long seqno, org.jgroups.Message msg)
          Called by AckSenderWindow to resend messages for which no ACK has been received yet
 boolean setProperties(java.util.Properties props)
           
 void start()
           
 void stop()
           
 java.lang.Object up(org.jgroups.Event evt)
           
 
Methods inherited from class org.jgroups.stack.Protocol
destroy, downThreadEnabled, enableStats, getDownProtocol, getProperties, getUpProtocol, init, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, setDownProtocol, setPropertiesInternal, setProtocolStack, setUpProtocol, statsEnabled, upThreadEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JOLSR_UNICAST

public JOLSR_UNICAST()
Method Detail

down

public java.lang.Object down(org.jgroups.Event evt)
Overrides:
down in class org.jgroups.stack.Protocol

dumpStats

public java.util.Map<java.lang.String,java.lang.Object> dumpStats()
Overrides:
dumpStats in class org.jgroups.stack.Protocol

getLocalAddress

public java.lang.String getLocalAddress()

getMembers

public java.lang.String getMembers()

getName

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

Specified by:
getName in class org.jgroups.stack.Protocol

getNumAcksReceived

public long getNumAcksReceived()

getNumAcksSent

public long getNumAcksSent()

getNumberOfMessagesInReceiveWindows

public int getNumberOfMessagesInReceiveWindows()

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()

getUnackedMessages

public java.lang.String getUnackedMessages()

printConnections

public java.lang.String printConnections()

resetStats

public void resetStats()
Overrides:
resetStats in class org.jgroups.stack.Protocol

retransmit

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

Specified by:
retransmit in interface org.jgroups.stack.AckSenderWindow.RetransmitCommand

setProperties

public boolean setProperties(java.util.Properties props)
Overrides:
setProperties in class org.jgroups.stack.Protocol

start

public void start()
           throws java.lang.Exception
Overrides:
start in class org.jgroups.stack.Protocol
Throws:
java.lang.Exception

stop

public void stop()
Overrides:
stop in class org.jgroups.stack.Protocol

up

public java.lang.Object up(org.jgroups.Event evt)
Overrides:
up in class org.jgroups.stack.Protocol