| |
|
| java.lang.Object java.lang.Thread org.jgroups.stack.UpHandler org.jgroups.protocols.FC
FC | public class FC extends Protocol (Code) | | 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
Changes (Brian) April 2006:
- Receivers now send credits to a sender when more than min_credits have been received (rather than when min_credits
are left)
- Receivers don't send the full credits (max_credits), but rather tha actual number of bytes received
author: Bela Ban version: $Id: FC.java,v 1.53.2.11 2007/04/27 08:03:51 belaban Exp $ |
CREDIT_REQUEST_HDR | final static FcHeader CREDIT_REQUEST_HDR(Code) | | |
REPLENISH_HDR | final static FcHeader REPLENISH_HDR(Code) | | |
creditors | final List creditors(Code) | | List of members from whom we expect credits
|
lock | final Sync lock(Code) | | Lock to be used with the CondVar below.
|
mutex | final CondVar mutex(Code) | | Mutex to block on down()
|
pending_requesters | final Set pending_requesters(Code) | | Peers who have asked for credit that we didn't have
|
received | final Map received(Code) | | HashMap: keys are members, values are credits left (in bytes).
For each receive, the credits for the sender are decremented by the size of the received message.
When the credits are 0, we refill and send a CREDIT message to the sender. Sender blocks until CREDIT
is received after reaching min_credits credits.
|
sent | final Map sent(Code) | | HashMap: keys are members, values are credits left. For each send, the
number of credits is decremented by the message size
|
getAverageTimeBlocked | public double getAverageTimeBlocked()(Code) | | |
getMaxBlockTime | public long getMaxBlockTime()(Code) | | |
getMaxCredits | public long getMaxCredits()(Code) | | |
getMinCredits | public long getMinCredits()(Code) | | |
getMinThreshold | public double getMinThreshold()(Code) | | |
getNumberOfBlockings | public int getNumberOfBlockings()(Code) | | |
getNumberOfCreditRequestsReceived | public int getNumberOfCreditRequestsReceived()(Code) | | |
getNumberOfCreditRequestsSent | public int getNumberOfCreditRequestsSent()(Code) | | |
getNumberOfCreditResponsesReceived | public int getNumberOfCreditResponsesReceived()(Code) | | |
getNumberOfCreditResponsesSent | public int getNumberOfCreditResponsesSent()(Code) | | |
getTotalTimeBlocked | public long getTotalTimeBlocked()(Code) | | |
isBlocked | public boolean isBlocked()(Code) | | |
printReceiverCredits | public String printReceiverCredits()(Code) | | |
receiveDownEvent | protected void receiveDownEvent(Event evt)(Code) | | 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 !
Parameters: evt - |
resetStats | public void resetStats()(Code) | | |
setMaxBlockTime | public void setMaxBlockTime(long t)(Code) | | |
setMaxCredits | public void setMaxCredits(long max_credits)(Code) | | |
setMinCredits | public void setMinCredits(long min_credits)(Code) | | |
setMinThreshold | public void setMinThreshold(double min_threshold)(Code) | | |
showLastBlockingTimes | public String showLastBlockingTimes()(Code) | | |
unblock | public void unblock()(Code) | | Allows to unblock a blocked sender from an external program, e.g. JMX
|
Fields inherited from org.jgroups.stack.UpHandler | final protected Log log(Code)(Java Doc)
|
|
|
|