类 Sampler


  • public abstract class Sampler
    extends java.lang.Object
    Utils for run code by sampling.
    • 构造器概要

      构造器 
      构造器 说明
      Sampler()  
    • 方法概要

      所有方法 静态方法 实例方法 抽象方法 具体方法 
      修饰符和类型 方法 说明
      static Sampler random​(double rate)
      Return a sampler sample by random
      static Sampler random​(java.util.Random random, double rate)
      Return a random sampler, with specific random instance, and rate
      static Sampler roundRobin​(double rate)
      Return a sampler sample by round robin
      void run​(java.lang.Runnable runnable)
      Run code by sampling
      abstract boolean shouldRun()
      If should really run for this time
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • Sampler

        public Sampler()
    • 方法详细资料

      • random

        public static Sampler random​(double rate)
        Return a sampler sample by random
        参数:
        rate - the rate to do really operation, should be [0,1]
        抛出:
        java.lang.IllegalArgumentException - if rate value is illegal
      • random

        public static Sampler random​(java.util.Random random,
                                     double rate)
        Return a random sampler, with specific random instance, and rate
        参数:
        random - the random instance
        rate - the rate to do really operation, should be [0,1]
        抛出:
        java.lang.IllegalArgumentException - if rate value is illegal
      • roundRobin

        public static Sampler roundRobin​(double rate)
        Return a sampler sample by round robin
        参数:
        rate - the rate to do really operation, should be [0,1]
        抛出:
        java.lang.IllegalArgumentException - if rate value is illegal
      • run

        public void run​(java.lang.Runnable runnable)
        Run code by sampling
      • shouldRun

        public abstract boolean shouldRun()
        If should really run for this time