Package org.jgroups.protocols
Class UFC
java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.FlowControl
org.jgroups.protocols.UFC
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:
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 the actual number of bytes received
- Author:
- Bela Ban
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jgroups.protocols.FlowControl
FlowControl.Credit -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<Address, FlowControl.Credit> Mapinvalid input: '<'Address,Long>: keys are members, values are credits left.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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintlongprotected voidhandleCredit(Address sender, long increase) protected ObjecthandleDownMessage(Event evt, Message msg, Address dest, int length) protected booleanWhether the protocol handles message with dest == null || dest.isMulticastAddress()protected voidhandleViewChange(Vector<Address> mbrs) voidstop()This method is called on aChannel.disconnect().voidunblock()Allows to unblock all blocked senders from an external program, e.g.Methods inherited from class org.jgroups.protocols.FlowControl
adjustCredit, down, getAverageTimeBlocked, getMaxBlockTime, getMaxBlockTime, getMaxBlockTimes, getMaxCredits, getMinCredits, getMinThreshold, getNumberOfCreditRequestsReceived, getNumberOfCreditRequestsSent, getNumberOfCreditResponsesReceived, getNumberOfCreditResponsesSent, handleConfigEvent, handleCreditRequest, init, printMap, printReceiverCredits, resetStats, sendCredit, sendCreditRequest, setMaxBlockTime, setMaxBlockTimes, setMaxCredits, setMinCredits, setMinThreshold, start, upMethods inherited from class org.jgroups.stack.Protocol
destroy, downThreadEnabled, enableStats, getConfigurableObjects, getDownProtocol, getId, getLevel, getName, getProperties, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getValue, isErgonomics, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, setDownProtocol, setErgonomics, setId, setLevel, setProperties, setPropertiesInternal, setProperty, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled, upThreadEnabled
-
Field Details
-
sent
Mapinvalid input: '<'Address,Long>: keys are members, values are credits left. For each send, the number of credits is decremented by the message size
-
-
Constructor Details
-
UFC
public UFC()
-
-
Method Details
-
printSenderCredits
- Specified by:
printSenderCreditsin classFlowControl
-
printCredits
- Overrides:
printCreditsin classFlowControl
-
dumpStats
- Overrides:
dumpStatsin classFlowControl
-
handleMulticastMessage
protected boolean handleMulticastMessage()Description copied from class:FlowControlWhether the protocol handles message with dest == null || dest.isMulticastAddress()- Specified by:
handleMulticastMessagein classFlowControl- Returns:
-
unblock
public void unblock()Description copied from class:FlowControlAllows to unblock all blocked senders from an external program, e.g. JMX- Overrides:
unblockin classFlowControl
-
getNumberOfBlockings
public int getNumberOfBlockings()- Specified by:
getNumberOfBlockingsin classFlowControl
-
getTotalTimeBlocked
public long getTotalTimeBlocked()- Specified by:
getTotalTimeBlockedin classFlowControl
-
stop
public void stop()Description copied from class:ProtocolThis method is called on aChannel.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- Overrides:
stopin classFlowControl
-
handleDownMessage
- Specified by:
handleDownMessagein classFlowControl
-
handleViewChange
- Overrides:
handleViewChangein classFlowControl
-
handleCredit
- Specified by:
handleCreditin classFlowControl
-