Class MFC

  • All Implemented Interfaces:
    Lifecycle
    Direct Known Subclasses:
    MFC_NB

    public class MFC
    extends FlowControl
    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:

    1. Receivers now send credits to a sender when more than min_credits have been received (rather than when min_credits are left)
    2. Receivers don't send the full credits (max_credits), but rather the actual number of bytes received
      Author:
      Bela Ban
      • Field Detail

        • MFC_REPLENISH_HDR

          protected static final FcHeader MFC_REPLENISH_HDR
        • MFC_CREDIT_REQUEST_HDR

          protected static final FcHeader MFC_CREDIT_REQUEST_HDR
        • credits

          protected CreditMap credits
          Maintains credits per member
        • last_credit_request

          protected long last_credit_request
          Last time a credit request was sent. Used to prevent credit request storms
      • Constructor Detail

        • MFC

          public MFC()
      • Method Detail

        • unblock

          public void unblock()
          Allows to unblock a blocked sender from an external program, e.g. JMX
          Overrides:
          unblock in class FlowControl
        • replenish

          public void replenish​(Address mbr,
                                long credits)
        • handleMulticastMessage

          protected boolean handleMulticastMessage()
          Description copied from class: FlowControl
          Whether the protocol handles message with dest == null || dest.isMulticastAddress()
          Specified by:
          handleMulticastMessage in class FlowControl
        • 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 interface Lifecycle
          Overrides:
          init in class FlowControl
          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
        • createCreditMap

          protected CreditMap createCreditMap​(long max_creds)
        • needToSendCreditRequest

          protected boolean needToSendCreditRequest()