Simple flow control protocol based on a credit system. Each sender has a number of credits (bytes
to send). When the credits have been exhausted, the sender blocks. Each receiver also keeps track of
how many credits it has received from a sender. When credits for a sender fall below a threshold,
the receiver sends more credits to the sender. Works for both unicast and multicast messages.
Note that this protocol must be located towards the top of the stack, or all down_threads from JChannel to this
protocol must be set to false ! This is in order to block JChannel.send()/JChannel.down().
This is the second simplified implementation of the same model. The algorithm is sketched out in
doc/FlowControl.txt
getAverageTimeBlocked
public double getAverageTimeBlocked()
getMaxBlockTime
public long getMaxBlockTime()
getMaxCredits
public long getMaxCredits()
getMinCredits
public long getMinCredits()
getMinThreshold
public double getMinThreshold()
getNumberOfBlockings
public int getNumberOfBlockings()
getNumberOfCreditRequestsReceived
public int getNumberOfCreditRequestsReceived()
getNumberOfCreditRequestsSent
public int getNumberOfCreditRequestsSent()
getNumberOfCreditResponsesReceived
public int getNumberOfCreditResponsesReceived()
getNumberOfCreditResponsesSent
public int getNumberOfCreditResponsesSent()
getTotalTimeBlocked
public long getTotalTimeBlocked()
isBlocked
public boolean isBlocked()
printCredits
public String printCredits()
printReceiverCredits
public String printReceiverCredits()
printSenderCredits
public String printSenderCredits()
receiveDownEvent
protected void receiveDownEvent(Event evt)
We need to receive view changes concurrent to messages on the down events: a message might blocks, e.g.
because we don't have enough credits to send to member P. However, if member P crashed, we need to unblock !
- receiveDownEvent in interface Protocol
setMaxBlockTime
public void setMaxBlockTime(long t)
setMaxCredits
public void setMaxCredits(long max_credits)
setMinCredits
public void setMinCredits(long min_credits)
setMinThreshold
public void setMinThreshold(double min_threshold)
showLastBlockingTimes
public String showLastBlockingTimes()
start
public void start()
throws Exception
- start in interface Protocol
unblock
public void unblock()
Allows to unblock a blocked sender from an external program, e.g. JMX