Class DiscreteTimePeriodsThrottler

  • All Implemented Interfaces:
    Throttler

    public class DiscreteTimePeriodsThrottler
    extends Object
    implements Throttler
    Throttles the operations to hit the target ops per second. To avoid hitting the target very fast and then sleeping for very long splits the second into smaller time segments and then counts operations within these smaller segments. When target ops count during the smaller chunk is reached, sleeps for the remaining time of the time segment. If target is higher than incoming ops rate then doesn't do anything
    • Constructor Detail

      • DiscreteTimePeriodsThrottler

        public DiscreteTimePeriodsThrottler​(int targetOpsPerSecond,
                                            int discretenessHz)
    • Method Detail