public class UNICAST3 extends Protocol implements AgeOutCache.Handler<Address>
Modifier and Type | Class and Description |
---|---|
protected class |
UNICAST3.Entry |
static class |
UNICAST3.Header
The following types and fields are serialized:
|
protected class |
UNICAST3.ReceiverEntry |
protected class |
UNICAST3.RetransmitTask
Retransmitter task which periodically (every xmit_interval ms):
If any of the receiver windows have the ack flag set, clears the flag and sends an ack for the
highest delivered seqno to the sender
Checks all receiver windows for missing messages and asks senders for retransmission
For all sender windows, checks if highest acked (HA) < highest sent (HS).
|
protected class |
UNICAST3.SenderEntry |
protected static class |
UNICAST3.State |
Modifier and Type | Field and Description |
---|---|
protected boolean |
ack_batches_immediately
Deprecated.
|
protected int |
ack_threshold |
protected AgeOutCache<Address> |
cache |
protected long |
conn_close_timeout |
protected long |
conn_expiry_timeout |
protected static long |
DEFAULT_FIRST_SEQNO |
protected static Filter<Message> |
dont_loopback_filter |
protected Filter<Message> |
drop_oob_and_dont_loopback_msgs_filter |
protected static Message |
DUMMY_OOB_MSG |
protected short |
last_conn_id |
protected ExpiryCache<Address> |
last_sync_sent
Keep track of when a SEND_FIRST_SEQNO message was sent to a given sender
|
protected Address |
local_addr |
protected boolean |
log_not_found_msgs |
protected int |
max_msg_batch_size |
protected long |
max_retransmit_time |
protected int |
max_xmit_req_size |
protected java.util.List<Address> |
members |
protected long |
num_acks_received |
protected long |
num_acks_sent |
protected long |
num_msgs_received |
protected long |
num_msgs_sent |
protected long |
num_xmits |
protected java.util.concurrent.ConcurrentMap<Address,UNICAST3.ReceiverEntry> |
recv_table |
protected java.util.concurrent.locks.ReentrantLock |
recv_table_lock |
protected boolean |
running |
protected java.util.concurrent.ConcurrentMap<Address,UNICAST3.SenderEntry> |
send_table |
protected long |
sync_min_interval |
protected TimeService |
time_service |
protected TimeScheduler |
timer |
protected java.util.concurrent.atomic.AtomicLong |
timestamper |
protected long |
xmit_interval |
protected java.util.concurrent.atomic.AtomicLong |
xmit_reqs_received |
protected java.util.concurrent.atomic.AtomicLong |
xmit_reqs_sent |
protected java.util.concurrent.atomic.AtomicLong |
xmit_rsps_sent |
protected long |
xmit_table_max_compaction_time |
protected int |
xmit_table_msgs_per_row |
protected int |
xmit_table_num_rows |
protected double |
xmit_table_resize_factor |
protected java.util.concurrent.Future<?> |
xmit_task
RetransmitTask running every xmit_interval ms
|
protected java.util.Map<Address,java.lang.Long> |
xmit_task_map
Used by the retransmit task to keep the last retransmitted seqno per sender (https://issues.jboss.org/browse/JGRP-1539)
|
after_creation_hook, down_prot, ergonomics, id, log, name, stack, stats, up_prot
Constructor and Description |
---|
UNICAST3() |
Modifier and Type | Method and Description |
---|---|
void |
closeConnection(Address mbr)
Removes and resets from connection table (which is already locked).
|
void |
closeIdleConnections() |
void |
closeReceiveConnection(Address mbr) |
void |
closeSendConnection(Address mbr) |
protected static int |
compare(long ts1,
long ts2)
Compares 2 timestamps, handles numeric overflow
|
protected UNICAST3.ReceiverEntry |
createReceiverEntry(Address sender,
long seqno,
short conn_id) |
protected void |
deliverBatch(MessageBatch batch) |
protected void |
deliverMessage(Event evt,
Address sender,
long seqno) |
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() |
protected short |
getNewConnectionId() |
long |
getNumAcksReceived() |
long |
getNumAcksSent() |
int |
getNumConnections() |
long |
getNumMessagesReceived() |
long |
getNumMessagesSent() |
int |
getNumReceiveConnections() |
int |
getNumSendConnections() |
int |
getNumUnackedMessages()
The number of messages in all Entry.sent_msgs tables (haven't received an ACK yet)
|
long |
getNumXmits() |
protected UNICAST3.ReceiverEntry |
getReceiverEntry(Address sender,
long seqno,
boolean first,
short conn_id) |
protected UNICAST3.SenderEntry |
getSenderEntry(Address dst) |
protected long |
getTimestamp() |
long |
getTimestamper() |
long |
getXmitTableMissingMessages() |
int |
getXmitTableNumCompactions() |
int |
getXmitTableNumMoves() |
int |
getXmitTableNumPurges() |
int |
getXmitTableNumResizes() |
long |
getXmitTableUndeliveredMessages() |
protected void |
handleAckReceived(Address sender,
long seqno,
short conn_id,
long timestamp)
Add the ACK to hashtable.sender.sent_msgs
|
protected void |
handleBatchFromSelf(MessageBatch batch,
UNICAST3.Entry entry) |
protected void |
handleBatchReceived(UNICAST3.ReceiverEntry entry,
Address sender,
java.util.List<Tuple<java.lang.Long,Message>> msgs,
boolean oob) |
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). |
protected void |
handleDataReceivedFromSelf(Address sender,
long seqno,
Message msg)
Called when the sender of a message is the local member.
|
protected void |
handleResendingOfFirstMessage(Address sender,
long timestamp)
We need to resend the first message with our conn_id
|
protected void |
handleUpEvent(Address sender,
Message msg,
UNICAST3.Header hdr) |
protected void |
handleXmitRequest(Address sender,
SeqnoList missing) |
boolean |
hasSendConnectionTo(Address dest)
Used for testing only
|
void |
init()
Called after instance has been created (null constructor) and before protocol is started.
|
boolean |
isXmitTaskRunning() |
java.lang.String |
printAgeOutCache() |
java.lang.String |
printConnections() |
protected java.lang.String |
printMessageList(java.util.List<Tuple<java.lang.Long,Message>> list) |
java.lang.String |
printReceiveWindowMessages() |
java.lang.String |
printSendWindowMessages() |
protected void |
processInternalMessage(Table<Message> win,
Address sender) |
void |
removeAllConnections()
This method is public only so it can be invoked by unit testing, but should not otherwise be used !
|
protected void |
removeAndDeliver(java.util.concurrent.atomic.AtomicBoolean processing,
Table<Message> win,
Address sender)
Try to remove as many messages as possible from the table as pass them up.
|
int |
removeExpiredConnections() |
protected void |
removeReceiveConnection(Address mbr) |
protected void |
removeSendConnection(Address mbr) |
void |
resetStats() |
protected void |
retransmit(Message msg)
Called by the sender to resend messages for which no ACK has been received yet
|
protected void |
retransmit(SeqnoList missing,
Address sender)
Sends a retransmit request to the given sender
|
protected void |
sendAck(Address dst,
long seqno,
short conn_id) |
void |
sendClose(Address dest,
short conn_id) |
void |
sendPendingAcks() |
protected void |
sendRequestForFirstSeqno(Address dest) |
void |
setMaxMessageBatchSize(int size) |
void |
setMaxRetransmitTime(long max_retransmit_time) |
void |
start()
This method is called on a
Channel.connect(String) . |
protected void |
startRetransmitTask() |
void |
stop()
This method is called on a
Channel.disconnect() . |
protected void |
stopRetransmitTask() |
void |
triggerXmit() |
java.lang.Object |
up(Event evt)
An event was received from the layer below.
|
void |
up(MessageBatch batch)
Sends up a multiple messages in a
MessageBatch . |
protected void |
update(UNICAST3.Entry entry,
int num_received) |
accept, afterCreationHook, destroy, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled
protected static final long DEFAULT_FIRST_SEQNO
protected int max_msg_batch_size
protected long conn_expiry_timeout
protected long conn_close_timeout
protected int xmit_table_num_rows
protected int xmit_table_msgs_per_row
protected double xmit_table_resize_factor
protected long xmit_table_max_compaction_time
protected long max_retransmit_time
protected long xmit_interval
protected boolean log_not_found_msgs
@Deprecated protected boolean ack_batches_immediately
protected int ack_threshold
protected long sync_min_interval
protected int max_xmit_req_size
protected long num_msgs_sent
protected long num_msgs_received
protected long num_acks_sent
protected long num_acks_received
protected long num_xmits
protected final java.util.concurrent.atomic.AtomicLong xmit_reqs_received
protected final java.util.concurrent.atomic.AtomicLong xmit_reqs_sent
protected final java.util.concurrent.atomic.AtomicLong xmit_rsps_sent
protected final java.util.concurrent.ConcurrentMap<Address,UNICAST3.SenderEntry> send_table
protected final java.util.concurrent.ConcurrentMap<Address,UNICAST3.ReceiverEntry> recv_table
protected final java.util.concurrent.locks.ReentrantLock recv_table_lock
protected final java.util.Map<Address,java.lang.Long> xmit_task_map
protected java.util.concurrent.Future<?> xmit_task
protected volatile java.util.List<Address> members
protected Address local_addr
protected TimeScheduler timer
protected volatile boolean running
protected short last_conn_id
protected AgeOutCache<Address> cache
protected TimeService time_service
protected final java.util.concurrent.atomic.AtomicLong timestamper
protected ExpiryCache<Address> last_sync_sent
protected static final Message DUMMY_OOB_MSG
protected final Filter<Message> drop_oob_and_dont_loopback_msgs_filter
public void setMaxMessageBatchSize(int size)
public java.lang.String getLocalAddress()
public java.lang.String getMembers()
public int getNumSendConnections()
public int getNumReceiveConnections()
public int getNumConnections()
public long getTimestamper()
public java.lang.String printConnections()
public long getNumMessagesSent()
public long getNumMessagesReceived()
public long getNumAcksSent()
public long getNumAcksReceived()
public long getNumXmits()
public long getMaxRetransmitTime()
public void setMaxRetransmitTime(long max_retransmit_time)
public boolean isXmitTaskRunning()
public int getAgeOutCacheSize()
public java.lang.String printAgeOutCache()
public AgeOutCache<Address> getAgeOutCache()
public boolean hasSendConnectionTo(Address dest)
public int getNumUnackedMessages()
public long getXmitTableUndeliveredMessages()
public long getXmitTableMissingMessages()
public int getXmitTableNumCompactions()
public int getXmitTableNumMoves()
public int getXmitTableNumResizes()
public int getXmitTableNumPurges()
public java.lang.String printReceiveWindowMessages()
public java.lang.String printSendWindowMessages()
public void resetStats()
resetStats
in class Protocol
public java.util.Map<java.lang.String,java.lang.Object> dumpStats()
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()
.protected void handleUpEvent(Address sender, Message msg, UNICAST3.Header hdr)
public void up(MessageBatch batch)
Protocol
MessageBatch
. The sender of the batch is always the same, and so is the
destination (null == multicast messages). Messages in a batch can be OOB messages, regular messages, or mixed
messages, although the transport itself will create initial MessageBatches that contain only either OOB or
regular messages.
The default processing below sends messages up the stack individually, based on a matching criteria
(calling Protocol.accept(org.jgroups.Message)
), and - if true - calls Protocol.up(org.jgroups.Event)
for that message and removes the message. If the batch is not empty, it is passed up, or else it is dropped.
Subclasses should check if there are any messages destined for them (e.g. using
MessageBatch.getMatchingMessages(short,boolean)
), then possibly remove and process them and finally pass
the batch up to the next protocol. Protocols can also modify messages in place, e.g. ENCRYPT could decrypt all
encrypted messages in the batch, not remove them, and pass the batch up when done.protected void handleBatchFromSelf(MessageBatch batch, UNICAST3.Entry entry)
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 closeConnection(Address mbr)
public void closeSendConnection(Address mbr)
public void closeReceiveConnection(Address mbr)
protected void removeSendConnection(Address mbr)
protected void removeReceiveConnection(Address mbr)
public void removeAllConnections()
protected void retransmit(SeqnoList missing, Address sender)
protected void retransmit(Message msg)
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.protected void handleDataReceivedFromSelf(Address sender, long seqno, Message msg)
protected void handleBatchReceived(UNICAST3.ReceiverEntry entry, Address sender, java.util.List<Tuple<java.lang.Long,Message>> msgs, boolean oob)
protected void removeAndDeliver(java.util.concurrent.atomic.AtomicBoolean processing, Table<Message> win, Address sender)
protected java.lang.String printMessageList(java.util.List<Tuple<java.lang.Long,Message>> list)
protected UNICAST3.ReceiverEntry getReceiverEntry(Address sender, long seqno, boolean first, short conn_id)
protected UNICAST3.SenderEntry getSenderEntry(Address dst)
protected UNICAST3.ReceiverEntry createReceiverEntry(Address sender, long seqno, short conn_id)
protected void handleAckReceived(Address sender, long seqno, short conn_id, long timestamp)
protected void handleResendingOfFirstMessage(Address sender, long timestamp)
sender
- protected void deliverBatch(MessageBatch batch)
protected long getTimestamp()
protected void startRetransmitTask()
protected void stopRetransmitTask()
protected void sendAck(Address dst, long seqno, short conn_id)
protected short getNewConnectionId()
protected void sendRequestForFirstSeqno(Address dest)
public void sendClose(Address dest, short conn_id)
public void closeIdleConnections()
public int removeExpiredConnections()
protected void update(UNICAST3.Entry entry, int num_received)
protected static int compare(long ts1, long ts2)
public void triggerXmit()
public void sendPendingAcks()
Copyright © 1998-2020 Red Hat. All Rights Reserved.