Class UFC

  • Direct Known Subclasses:
    UFC_NB

    public class UFC
    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

        • UFC_REPLENISH_HDR

          protected static final FcHeader UFC_REPLENISH_HDR
        • UFC_CREDIT_REQUEST_HDR

          protected static final FcHeader UFC_CREDIT_REQUEST_HDR
        • sent

          protected final java.util.Map<Address,​? extends Credit> sent
          Map: keys are members, values are credits left. For each send, the number of credits is decremented by the message size
      • Constructor Detail

        • UFC

          public UFC()
      • Method Detail

        • 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
          Returns:
        • unblock

          public void unblock()
          Description copied from class: FlowControl
          Allows to unblock all blocked senders from an external program, e.g. JMX
          Overrides:
          unblock in class FlowControl
        • getSenderCreditsFor

          public long getSenderCreditsFor​(Address mbr)
        • stop

          public void stop()
          Description copied from class: Protocol
          This method is called on a JChannel.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:
          stop in class FlowControl
        • createCredit

          protected <T extends Credit> T createCredit​(int initial_credits)