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 |
---|---|
protected class |
UNICAST2.ConnectionReaper |
static class |
UNICAST2.Unicast2Header
The following types and fields are serialized:
|
Modifier and Type | Field and Description |
---|---|
protected long |
conn_expiry_timeout |
protected Future<?> |
connection_reaper |
static long |
DEFAULT_FIRST_SEQNO |
protected long |
max_bytes |
protected long |
max_retransmit_time |
protected int |
max_stable_msgs |
protected ReentrantLock |
recv_table_lock |
protected long |
stable_interval |
Constructor and Description |
---|
UNICAST2() |
Modifier and Type | Method and Description |
---|---|
void |
compact() |
Object |
down(Event evt)
An event is to be sent down the stack.
|
Map<String,Object> |
dumpStats() |
void |
expired(Address key)
Called by AgeOutCache, to removed expired connections
|
AgeOutCache<Address> |
getAgeOutCache() |
int |
getAgeOutCacheSize() |
String |
getLocalAddress() |
long |
getMaxRetransmitTime() |
String |
getMembers() |
int |
getNumberOfMessagesInReceiveWindows() |
long |
getNumberOfRetransmissions() |
long |
getNumBytesReceived() |
long |
getNumBytesSent() |
int |
getNumConnections() |
long |
getNumMessagesReceived() |
long |
getNumMessagesSent() |
int |
getNumReceiveConnections() |
int |
getNumSendConnections() |
long |
getPendingXmitRequests() |
int[] |
getTimeout() |
TimeScheduler |
getTimer() |
protected void |
handleDataReceived(Address sender,
long seqno,
short conn_id,
boolean first,
Message msg,
Event evt)
Check whether the hashtable contains an entry e for
sender (create if not). |
void |
init()
Called after instance has been created (null constructor) and before protocol is started.
|
boolean |
isConnectionReaperRunning() |
String |
printAgeOutCache() |
String |
printConnections() |
String |
printRetransmitTableSizes() |
void |
purgeAndCompact() |
void |
reapIdleConnections() |
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 |
removeReceiveConnection(Address mbr) |
void |
removeSendConnection(Address mbr) |
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,
short conn_id,
long low,
long high) |
void |
sendStableMessages() |
void |
setMaxMessageBatchSize(int size) |
void |
setMaxRetransmitTime(long max_retransmit_time) |
void |
setTimeout(int[] val) |
void |
setTimer(TimeScheduler timer)
Only used for unit tests, don't use !
|
protected void |
stable(Address sender,
short conn_id,
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) . |
protected void |
startConnectionReaper() |
void |
stop()
This method is called on a
Channel.disconnect() . |
protected void |
stopConnectionReaper() |
Object |
up(Event evt)
An event was received from the layer below.
|
destroy, enableStats, getConfigurableObjects, getDownProtocol, getId, getLevel, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getValue, isErgonomics, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled
public static final long DEFAULT_FIRST_SEQNO
protected long max_bytes
protected long stable_interval
protected int max_stable_msgs
protected long conn_expiry_timeout
protected final ReentrantLock recv_table_lock
protected long max_retransmit_time
protected Future<?> connection_reaper
public int[] getTimeout()
public void setTimeout(int[] val)
public void setMaxMessageBatchSize(int size)
public String getLocalAddress()
public String getMembers()
public int getNumSendConnections()
public int getNumReceiveConnections()
public int getNumConnections()
public String printConnections()
public boolean isConnectionReaperRunning()
public long getNumMessagesSent()
public long getNumMessagesReceived()
public long getNumBytesSent()
public long getNumBytesReceived()
public long getNumberOfRetransmissions()
public long getPendingXmitRequests()
public long getMaxRetransmitTime()
public void setMaxRetransmitTime(long max_retransmit_time)
public int getAgeOutCacheSize()
public String printAgeOutCache()
public AgeOutCache<Address> getAgeOutCache()
public int getNumberOfMessagesInReceiveWindows()
public String printRetransmitTableSizes()
public void compact()
public void purgeAndCompact()
public void resetStats()
resetStats
in class Protocol
public TimeScheduler getTimer()
public void setTimer(TimeScheduler timer)
timer
- public void init() throws Exception
Protocol
public void start() throws 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
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 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 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, short conn_id, long highest_delivered, long highest_seen)
sender
- highest_delivered
- highest_seen
- public void sendStableMessages()
protected void sendStableMessage(Address dest, short conn_id, long low, long high)
protected void startConnectionReaper()
protected void stopConnectionReaper()
public void removeConnection(Address mbr)
public void removeSendConnection(Address mbr)
public void removeReceiveConnection(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
- protected void handleDataReceived(Address sender, long seqno, short conn_id, boolean first, Message msg, Event evt)
sender
(create if not). If
e.received_msgs is null and first
is true: create a new AckReceiverWindow(seqno) and
add message. Set e.received_msgs to the new window. Else just add the message.public void reapIdleConnections()
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.