Class FIFOBandwidthRefiller

  • All Implemented Interfaces:
    Runnable

    public class FIFOBandwidthRefiller
    extends Object
    implements Runnable
    Thread that runs several times a second to "give" bandwidth to FIFOBandwidthLimiter. Instantiated by FIFOBandwidthLimiter. As of 0.8.12, this also contains a counter for outbound participating bandwidth. This was a good place for it since we needed a thread for it. Public only for the properties and defaults.
    • Field Detail

      • DEFAULT_INBOUND_BANDWIDTH

        public static final int DEFAULT_INBOUND_BANDWIDTH
        See Also:
        Constant Field Values
      • DEFAULT_OUTBOUND_BANDWIDTH

        public static final int DEFAULT_OUTBOUND_BANDWIDTH
        Caution, do not make DEFAULT_OUTBOUND_BANDWIDTH * DEFAULT_SHARE_PCT > 32 without thinking about the implications (default connection limits, for example) of moving the default bandwidth class from L to M, or maybe adjusting bandwidth class boundaries.
        See Also:
        Constant Field Values
      • DEFAULT_INBOUND_BURST_BANDWIDTH

        public static final int DEFAULT_INBOUND_BURST_BANDWIDTH
        See Also:
        Constant Field Values
      • DEFAULT_OUTBOUND_BURST_BANDWIDTH

        public static final int DEFAULT_OUTBOUND_BURST_BANDWIDTH
        See Also:
        Constant Field Values
      • MIN_INBOUND_BANDWIDTH

        public static final int MIN_INBOUND_BANDWIDTH
        For now, until there is some tuning and safe throttling, we set the floor at this inbound (KBps)
        See Also:
        Constant Field Values
      • MIN_OUTBOUND_BANDWIDTH

        public static final int MIN_OUTBOUND_BANDWIDTH
        For now, until there is some tuning and safe throttling, we set the floor at this outbound (KBps)
        See Also:
        Constant Field Values
      • MIN_INBOUND_BANDWIDTH_PEAK

        public static final int MIN_INBOUND_BANDWIDTH_PEAK
        For now, until there is some tuning and safe throttling, we set the floor at this during burst (KBps)
        See Also:
        Constant Field Values
      • MIN_OUTBOUND_BANDWIDTH_PEAK

        public static final int MIN_OUTBOUND_BANDWIDTH_PEAK
        For now, until there is some tuning and safe throttling, we set the floor at this during burst (KBps)
        See Also:
        Constant Field Values
      • MAX_OUTBOUND_BANDWIDTH

        public static final int MAX_OUTBOUND_BANDWIDTH
        Max for reasonable Bloom filter false positive rate. Do not increase without adding a new Bloom filter size! See util/DecayingBloomFilter and tunnel/BloomFilterIVValidator.
        See Also:
        Constant Field Values
    • Method Detail

      • shutdown

        void shutdown()
        Since:
        0.8.8
      • run

        public void run()
        Specified by:
        run in interface Runnable
      • reinitialize

        void reinitialize()
      • getOutboundKBytesPerSecond

        int getOutboundKBytesPerSecond()
      • getInboundKBytesPerSecond

        int getInboundKBytesPerSecond()
      • getOutboundBurstKBytesPerSecond

        int getOutboundBurstKBytesPerSecond()
      • getInboundBurstKBytesPerSecond

        int getInboundBurstKBytesPerSecond()
      • incrementParticipatingMessageBytes

        void incrementParticipatingMessageBytes​(int size)
        We sent a message.
        Parameters:
        size - bytes
        Since:
        0.8.12
      • getCurrentParticipatingBandwidth

        int getCurrentParticipatingBandwidth()
        Out bandwidth. Actual bandwidth, not smoothed, not bucketed.
        Returns:
        Bps in recent period (a few seconds)
        Since:
        0.8.12