|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgroups.stack.Protocol
org.jgroups.protocols.FlowControl
org.jgroups.protocols.MFC
public class MFC
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:
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.jgroups.protocols.FlowControl |
---|
FlowControl.Credit |
Field Summary | |
---|---|
protected CreditMap |
credits
Maintains credits per member |
protected long |
last_credit_request
Last time a credit request was sent. |
Fields inherited from class org.jgroups.protocols.FlowControl |
---|
CREDIT_REQUEST_HDR, frag_size_received, ignore_synchronous_response, ignore_thread, max_block_time, max_block_times, max_credits, min_credits, min_threshold, num_credit_requests_received, num_credit_requests_sent, num_credit_responses_received, num_credit_responses_sent, received, REPLENISH_HDR, running |
Fields inherited from class org.jgroups.stack.Protocol |
---|
down_prot, ergonomics, id, log, name, stack, stats, up_prot |
Constructor Summary | |
---|---|
MFC()
|
Method Summary | |
---|---|
int |
getNumberOfBlockings()
|
long |
getTotalTimeBlocked()
|
protected void |
handleCredit(Address sender,
long increase)
|
protected java.lang.Object |
handleDownMessage(Event evt,
Message msg,
Address dest,
int length)
|
protected boolean |
handleMulticastMessage()
Whether the protocol handles message with dest == null || dest.isMulticastAddress() |
protected void |
handleViewChange(java.util.List<Address> mbrs)
|
void |
init()
Called after instance has been created (null constructor) and before protocol is started. |
protected boolean |
needToSendCreditRequest()
|
java.lang.String |
printCredits()
|
java.lang.String |
printSenderCredits()
|
void |
stop()
This method is called on a Channel.disconnect() . |
void |
unblock()
Allows to unblock a blocked sender from an external program, e.g. |
Methods inherited from class org.jgroups.stack.Protocol |
---|
destroy, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected CreditMap credits
protected long last_credit_request
Constructor Detail |
---|
public MFC()
Method Detail |
---|
public void unblock()
unblock
in class FlowControl
public java.lang.String printCredits()
printCredits
in class FlowControl
public java.lang.String printSenderCredits()
printSenderCredits
in class FlowControl
public int getNumberOfBlockings()
getNumberOfBlockings
in class FlowControl
public long getTotalTimeBlocked()
getTotalTimeBlocked
in class FlowControl
protected boolean handleMulticastMessage()
FlowControl
handleMulticastMessage
in class FlowControl
public void init() throws java.lang.Exception
Protocol
init
in class FlowControl
java.lang.Exception
- Thrown if protocol cannot be initialized successfully. This will cause the
ProtocolStack to fail, so the channel constructor 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 flushed
stop
in class FlowControl
protected java.lang.Object handleDownMessage(Event evt, Message msg, Address dest, int length)
handleDownMessage
in class FlowControl
protected boolean needToSendCreditRequest()
protected void handleCredit(Address sender, long increase)
handleCredit
in class FlowControl
protected void handleViewChange(java.util.List<Address> mbrs)
handleViewChange
in class FlowControl
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |