org.jgroups.protocols
public class UNICAST extends Protocol implements AckSenderWindow.RetransmitCommand, AgeOutCache.Handler<Address>
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).
Modifier and Type | Class and Description |
---|---|
static class |
UNICAST.UnicastHeader
The following types and fields are serialized:
|
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_FIRST_SEQNO |
protected long |
max_retransmit_time |
Constructor and Description |
---|
UNICAST() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
down(Event evt)
An event is to be sent down the stack.
|
java.util.Map<java.lang.String,java.lang.Object> |
dumpStats() |
void |
expired(Address key)
Called by AgeOutCache, to removed expired connections
|
AgeOutCache<Address> |
getAgeOutCache() |
int |
getAgeOutCacheSize() |
java.lang.String |
getLocalAddress() |
long |
getMaxRetransmitTime() |
java.lang.String |
getMembers() |
long |
getNumAcksReceived() |
long |
getNumAcksSent() |
int |
getNumberOfMessagesInReceiveWindows() |
long |
getNumberOfRetransmissions() |
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() |
long[] |
getTimeout() |
static int |
getUndeliveredMessages()
Deprecated.
|
java.lang.String |
printAgeOutCache() |
java.lang.String |
printConnections() |
java.lang.String |
printUnackedMessages() |
void |
removeAllConnections()
This method is public only so it can be invoked by unit testing, but should not otherwise be used !
|
void |
removeConnection(Address mbr)
Removes and resets from connection table (which is already locked).
|
void |
resetStats() |
void |
retransmit(long seqno,
Message msg)
Called by AckSenderWindow to resend messages for which no ACK has been received yet
|
void |
setMaxMessageBatchSize(int size) |
void |
setMaxRetransmitTime(long max_retransmit_time) |
void |
setTimeout(long[] val) |
void |
start()
This method is called on a
Channel.connect(String) . |
void |
stop()
This method is called on a
Channel.disconnect() . |
java.lang.Object |
up(Event evt)
An event was received from the layer below.
|
destroy, downThreadEnabled, enableStats, getConfigurableObjects, getDownProtocol, getId, getLevel, getName, getProperties, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getValue, init, isErgonomics, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, setDownProtocol, setErgonomics, setId, setLevel, setProperties, setPropertiesInternal, setProperty, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled, upThreadEnabled
public static final long DEFAULT_FIRST_SEQNO
protected long max_retransmit_time
@Deprecated public static int getUndeliveredMessages()
public long[] getTimeout()
public void setTimeout(long[] val)
public void setMaxMessageBatchSize(int size)
public java.lang.String getLocalAddress()
public java.lang.String getMembers()
public java.lang.String printConnections()
public long getNumMessagesSent()
public long getNumMessagesReceived()
public long getNumBytesSent()
public long getNumBytesReceived()
public long getNumAcksSent()
public long getNumAcksReceived()
public long getNumberOfRetransmissions()
public long getMaxRetransmitTime()
public void setMaxRetransmitTime(long max_retransmit_time)
public int getAgeOutCacheSize()
public java.lang.String printAgeOutCache()
public AgeOutCache<Address> getAgeOutCache()
public int getNumberOfUnackedMessages()
public java.lang.String printUnackedMessages()
public int getNumberOfMessagesInReceiveWindows()
public void resetStats()
resetStats
in class Protocol
public java.util.Map<java.lang.String,java.lang.Object> dumpStats()
public void start() throws java.lang.Exception
Protocol
Channel.connect(String)
. Starts work.
Protocols are connected and queues are ready to receive events.
Will be called from bottom to top. This call will replace
the START and START_OK events.start
in class Protocol
java.lang.Exception
- Thrown if protocol cannot be started successfully. This will cause the ProtocolStack
to fail, so Channel.connect(String)
will throw an exceptionpublic void stop()
Protocol
Channel.disconnect()
. Stops work (e.g. by closing multicast socket).
Will be called from top to bottom. This means that at the time of the method invocation the
neighbor protocol below is still working. This method will replace the
STOP, STOP_OK, CLEANUP and CLEANUP_OK events. The ProtocolStack guarantees that
when this method is called all messages in the down queue will have been flushedpublic java.lang.Object up(Event evt)
Protocol
down_prot.down()
or c) the event (or another event) is sent up
the stack using up_prot.up()
.public java.lang.Object down(Event evt)
Protocol
down_prot.down()
. In case of a GET_ADDRESS event (which tries to
retrieve the stack's address from one of the bottom layers), the layer may need to send
a new response event back up the stack using up_prot.up()
.public void removeConnection(Address mbr)
public void removeAllConnections()
public void retransmit(long seqno, Message msg)
retransmit
in interface AckSenderWindow.RetransmitCommand
public void expired(Address key)
expired
in interface AgeOutCache.Handler<Address>
key
- Copyright © 1998-2009 Bela Ban / Red Hat. All Rights Reserved.