Package org.jgroups.protocols
Class NAKACK4
- java.lang.Object
-
- org.jgroups.stack.Protocol
-
- org.jgroups.protocols.ReliableMulticast
-
- org.jgroups.protocols.NAKACK4
-
- All Implemented Interfaces:
Lifecycle
,DiagnosticsHandler.ProbeHandler
public class NAKACK4 extends ReliableMulticast
New multicast protocol based on fixed-size xmit windows and message ACKs
Details: https://issues.redhat.com/browse/JGRP-2780- Since:
- 5.4
- Author:
- Bela Ban
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jgroups.protocols.ReliableMulticast
ReliableMulticast.Entry, ReliableMulticast.LastSeqnoResender, ReliableMulticast.RetransmitTask
-
-
Field Summary
Fields Modifier and Type Field Description protected AckTable
ack_table
protected int
ack_threshold
protected java.util.concurrent.atomic.LongAdder
acks_received
protected java.util.function.IntBinaryOperator
add_acks
protected int
capacity
protected static Buffer.Options
SEND_OPTIONS
-
Fields inherited from class org.jgroups.protocols.ReliableMulticast
avg_batch_size, BATCH_ACCUMULATOR, become_server_queue, become_server_queue_size, cached_batches, digest_history, discard_delivered_msgs, DUMMY_OOB_MSG, HAS_HEADER, is_server, is_trace, last_seqno_resender, leaving, local_send_entry, local_xmit_table, log_discard_msgs, log_not_found_msgs, max_batch_size, max_xmit_req_size, members, no_dummy_and_no_oob_delivered_msgs_and_no_dont_loopback_msgs, num_messages_received, num_messages_sent, remove_filter, reuse_message_batches, running, send_atomically, sends_can_block, seqno, SEQNO_GETTER, stability_msgs, stable_xmit_map, suppress_log_non_member, suppress_time_non_member_warnings, timer, use_mcast_xmit, use_mcast_xmit_req, view, xmit_from_random_member, xmit_interval, xmit_reqs_received, xmit_reqs_sent, xmit_rsps_received, xmit_rsps_sent, xmit_table, xmit_task, xmit_task_map
-
Fields inherited from class org.jgroups.stack.Protocol
after_creation_hook, down_prot, ergonomics, id, local_addr, log, policies, stack, stats, up_prot
-
-
Constructor Summary
Constructors Constructor Description NAKACK4()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
ackThreshold()
NAKACK4
ackThreshold(int t)
protected boolean
addToSendBuffer(Buffer<Message> win, long seq, Message msg, java.util.function.Predicate<Message> filter, boolean dont_block)
Adds the message to the send buffer.protected void
adjustReceivers(java.util.List<Address> members)
Removes old members from xmit-table and adds new members to xmit-table (at seqnos hd=0, hr=0).int
capacity()
NAKACK4
capacity(int c)
void
changeCapacity(int new_capacity)
Changes the capacity of the buffer, basically by creating a new buffer and copying the messages from the old one.protected Buffer<Message>
createXmitWindow(long initial_seqno)
void
destroy()
This method is called on aJChannel.close()
.AverageMinMax
getAvgTimeBlocked()
long
getNumBlockings()
long
getNumDroppedMessages()
protected void
handleAck(Address sender, long ack)
void
init()
Called after a protocol has been created and before the protocol is started.protected boolean
needToSendAck(ReliableMulticast.Entry e)
protected boolean
needToSendAck(ReliableMulticast.Entry e, int num_acks)
java.lang.String
printAckTable()
protected void
reset()
void
resetStats()
protected void
sendAck(Address to, Buffer<Message> win)
Buffer.Options
sendOptions()
void
sendPendingAcks()
protected void
stable(Digest digest)
Garbage collect messages that have been seen by all members.-
Methods inherited from class org.jgroups.protocols.ReliableMulticast
clearCachedBatches, clearNonMemberCache, deliver, deliverBatch, discardDeliveredMsgs, discardDeliveredMsgs, down, down, flushBecomeServerQueue, getBecomeServerQueueSize, getBecomeServerQueueSizeActual, getBuf, getCurrentSeqno, getDigest, getDigest, getEntry, getMaxXmitReqSize, getNonMemberMessages, getNumMessagesReceived, getNumMessagesSent, getSizeOfAllMessages, getSizeOfAllMessagesInclHeaders, getSuppressTimeNonMemberWarnings, getXmitInterval, getXmitRequestsReceived, getXmitRequestsSent, getXmitResponsesReceived, getXmitResponsesSent, getXmitTableCapacity, getXmitTableMissingMessages, getXmitTableUndeliveredMsgs, handleHighestSeqno, handleMessage, handleMessageBatch, handleProbe, handleXmitReq, handleXmitRsp, isCallerRunsHandler, isTrace, isTrace, isXmitTaskRunning, logDiscardMessages, logDiscardMessages, logNotFoundMessages, logNotFoundMessages, mergeDigest, msgFromXmitRsp, overwriteDigest, printBatches, printCachedBatches, printDigestHistory, printMessages, printStabilityMessages, providedUpServices, queueMessage, removeAndDeliver, resend, retransmit, retransmit, reuseMessageBatches, reuseMessageBatches, send, sendAtomically, sendAtomically, sendBuf, sendEntry, sendsCanBlock, sendsCanBlock, sendXmitRsp, setBecomeServerQueueSize, setDigest, setDigest, setDiscardDeliveredMsgs, setLevel, setMaxXmitReqSize, setSuppressTimeNonMemberWarnings, setTimer, setXmitFromRandomMember, setXmitInterval, sizeOfAllMessages, start, startRetransmitTask, stop, stopRetransmitTask, supportedKeys, triggerXmit, unknownMember, up, up, up, useMcastXmit, useMcastXmit, useMcastXmitReq, useMcastXmitReq, xmitFromRandomMember, xmitFromRandomMember
-
Methods inherited from class org.jgroups.stack.Protocol
accept, addPolicy, addr, addr, afterCreationHook, down, enableStats, getAddress, getComponents, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getPolicies, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, policies, providedDownServices, removePolicy, requiredDownServices, requiredUpServices, resetStatistics, setAddress, setDownProtocol, setErgonomics, setId, setPolicies, setProtocolStack, setSocketFactory, setUpProtocol, setValue, statsEnabled, toString
-
-
-
-
Field Detail
-
ack_table
protected final AckTable ack_table
-
SEND_OPTIONS
protected static final Buffer.Options SEND_OPTIONS
-
capacity
protected int capacity
-
ack_threshold
protected int ack_threshold
-
acks_received
protected final java.util.concurrent.atomic.LongAdder acks_received
-
add_acks
protected final java.util.function.IntBinaryOperator add_acks
-
-
Method Detail
-
capacity
public int capacity()
-
capacity
public NAKACK4 capacity(int c)
-
ackThreshold
public int ackThreshold()
-
ackThreshold
public NAKACK4 ackThreshold(int t)
-
sendOptions
public Buffer.Options sendOptions()
- Overrides:
sendOptions
in classReliableMulticast
-
getNumBlockings
public long getNumBlockings()
-
getNumDroppedMessages
public long getNumDroppedMessages()
-
getAvgTimeBlocked
public AverageMinMax getAvgTimeBlocked()
-
createXmitWindow
protected Buffer<Message> createXmitWindow(long initial_seqno)
- Specified by:
createXmitWindow
in classReliableMulticast
-
resetStats
public void resetStats()
- Overrides:
resetStats
in classReliableMulticast
-
init
public void init() throws java.lang.Exception
Description copied from class:Protocol
Called after a protocol has been created and before the protocol is started. Attributes are already set. Other protocols are not yet connected and events cannot yet be sent.- Specified by:
init
in interfaceLifecycle
- Overrides:
init
in classReliableMulticast
- Throws:
java.lang.Exception
- Thrown if protocol cannot be initialized successfully. This will cause the ProtocolStack to fail, so the the channel constructor will throw an exception
-
destroy
public void destroy()
Description copied from class:Protocol
This method is called on aJChannel.close()
. Does some cleanup; after the call, the VM will terminate
-
printAckTable
public java.lang.String printAckTable()
-
sendPendingAcks
public void sendPendingAcks()
-
changeCapacity
public void changeCapacity(int new_capacity)
Changes the capacity of the buffer, basically by creating a new buffer and copying the messages from the old one. This method is only supposed to be used by perf testing, so DON'T USE!
-
adjustReceivers
protected void adjustReceivers(java.util.List<Address> members)
Description copied from class:ReliableMulticast
Removes old members from xmit-table and adds new members to xmit-table (at seqnos hd=0, hr=0). This method is not called concurrently- Overrides:
adjustReceivers
in classReliableMulticast
-
reset
protected void reset()
- Overrides:
reset
in classReliableMulticast
-
stable
protected void stable(Digest digest)
Description copied from class:ReliableMulticast
Garbage collect messages that have been seen by all members. Update sent_msgs: for the sender P in the digest which is equal to the local address, garbage collect all messages <= seqno at digest[P]. Update xmit_table: for each sender P in the digest and its highest seqno seen SEQ, garbage collect all delivered_msgs in the retransmit buffer corresponding to P which are <= seqno at digest[P].- Overrides:
stable
in classReliableMulticast
-
handleAck
protected void handleAck(Address sender, long ack)
- Overrides:
handleAck
in classReliableMulticast
-
needToSendAck
protected boolean needToSendAck(ReliableMulticast.Entry e)
- Overrides:
needToSendAck
in classReliableMulticast
-
needToSendAck
protected boolean needToSendAck(ReliableMulticast.Entry e, int num_acks)
- Overrides:
needToSendAck
in classReliableMulticast
-
sendAck
protected void sendAck(Address to, Buffer<Message> win)
- Overrides:
sendAck
in classReliableMulticast
-
addToSendBuffer
protected boolean addToSendBuffer(Buffer<Message> win, long seq, Message msg, java.util.function.Predicate<Message> filter, boolean dont_block)
Description copied from class:ReliableMulticast
Adds the message to the send buffer. The loop tries to handle temporary OOMEs by retrying if add() failed- Overrides:
addToSendBuffer
in classReliableMulticast
-
-