|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgroups.stack.Protocol
org.jgroups.protocols.UNICAST2
public class UNICAST2
Reliable unicast layer. Implemented with negative acks. Every sender keeps its messages in an AckSenderWindow. A receiver stores incoming messages in a NakReceiverWindow, and asks the sender for retransmission if a gap is detected. Every now and then (stable_interval), a timer task sends a STABLE message to all senders, including the highest received and delivered seqnos. A sender purges messages lower than highest delivered and asks the STABLE sender for messages it might have missed (smaller than highest received). A STABLE message can also be sent when a receiver has received more than max_bytes from a given sender.
The advantage of this protocol overUNICAST
is that it doesn't send acks for every
message. Instead, it sends 'acks' after receiving max_bytes and/ or periodically (stable_interval).
Nested Class Summary | |
---|---|
static class |
UNICAST2.Unicast2Header
The following types and fields are serialized: |
Field Summary | |
---|---|
static long |
DEFAULT_FIRST_SEQNO
|
protected long |
max_bytes
|
protected long |
max_retransmit_time
|
protected int |
max_stable_msgs
|
protected long |
stable_interval
|
Fields inherited from class org.jgroups.stack.Protocol |
---|
down_prot, ergonomics, id, log, name, stack, stats, up_prot |
Constructor Summary | |
---|---|
UNICAST2()
|
Method Summary | |
---|---|
void |
compact()
|
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()
|
int |
getNumberOfMessagesInReceiveWindows()
|
long |
getNumberOfRetransmissions()
|
long |
getNumBytesReceived()
|
long |
getNumBytesSent()
|
long |
getNumMessagesReceived()
|
long |
getNumMessagesSent()
|
long[] |
getTimeout()
|
TimeScheduler |
getTimer()
|
void |
init()
Called after instance has been created (null constructor) and before protocol is started. |
java.lang.String |
printAgeOutCache()
|
java.lang.String |
printConnections()
|
java.lang.String |
printRetransmitTableSizes()
|
void |
purgeAndCompact()
|
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 first_seqno,
long last_seqno,
Address sender)
Get the missing messages between sequence numbers first_seqno and last_seqno . |
protected void |
sendStableMessage(Address dest,
long low,
long high)
|
void |
sendStableMessages()
|
void |
setMaxMessageBatchSize(int size)
|
void |
setMaxRetransmitTime(long max_retransmit_time)
|
void |
setTimeout(long[] val)
|
void |
setTimer(TimeScheduler timer)
Only used for unit tests, don't use ! |
protected void |
stable(Address sender,
long highest_delivered,
long highest_seen)
Purge all messages in window for local_addr, which are <= low. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long DEFAULT_FIRST_SEQNO
protected long max_bytes
protected long stable_interval
protected int max_stable_msgs
protected long max_retransmit_time
Constructor Detail |
---|
public UNICAST2()
Method Detail |
---|
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 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 getNumberOfMessagesInReceiveWindows()
public java.lang.String printRetransmitTableSizes()
public void compact()
public void purgeAndCompact()
public void resetStats()
resetStats
in class Protocol
public java.util.Map<java.lang.String,java.lang.Object> dumpStats()
dumpStats
in class Protocol
public TimeScheduler getTimer()
public void setTimer(TimeScheduler timer)
timer
- public void init() throws java.lang.Exception
Protocol
init
in class Protocol
java.lang.Exception
- Thrown if protocol cannot be initialized successfully. This will cause the
ProtocolStack to fail, so the channel constructor will throw an exceptionpublic 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 flushed
stop
in class Protocol
public 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()
.
up
in class Protocol
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()
.
down
in class Protocol
protected void stable(Address sender, long highest_delivered, long highest_seen)
sender
- highest_delivered
- highest_seen
- public void sendStableMessages()
protected void sendStableMessage(Address dest, long low, long high)
public void removeConnection(Address mbr)
public void removeAllConnections()
public void retransmit(long first_seqno, long last_seqno, Address sender)
Retransmitter.RetransmitCommand
first_seqno
and last_seqno
.
This can either be done by sending a retransmit message to destination sender
(nak-based scheme), or by retransmitting the missing message(s) to sender
(ack-based scheme).
retransmit
in interface Retransmitter.RetransmitCommand
first_seqno
- The sequence number of the first missing messagelast_seqno
- The sequence number of the last missing messagesender
- The destination of the member to which the retransmit request will be sent
(nak-based scheme), or to which the message will be retransmitted (ack-based scheme).public void expired(Address key)
expired
in interface AgeOutCache.Handler<Address>
key
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |