public class UNICAST2 extends Protocol implements Retransmitter.RetransmitCommand, AgeOutCache.Handler<Address>
UNICAST
is that it doesn't send acks for every
message. Instead, it sends 'acks' after receiving max_bytes and/ or periodically (stable_interval).Modifier and Type | Class and Description |
---|---|
static class |
UNICAST2.Unicast2Header
The following types and fields are serialized:
|
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_FIRST_SEQNO |
protected long |
max_bytes |
protected long |
max_retransmit_time |
protected int |
max_stable_msgs |
protected long |
stable_interval |
Constructor and Description |
---|
UNICAST2() |
Modifier and Type | Method and Description |
---|---|
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.
|
destroy, downThreadEnabled, enableStats, getConfigurableObjects, getDownProtocol, getId, getLevel, getName, getProperties, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getValue, 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_bytes
protected long stable_interval
protected int max_stable_msgs
protected long max_retransmit_time
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()
public TimeScheduler getTimer()
public void setTimer(TimeScheduler timer)
timer
- public void init() throws java.lang.Exception
Protocol
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()
.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
- Copyright ? 1998-2009 Bela Ban / Red Hat. All Rights Reserved.