test_class.file: dubbo-common/src/test/java/org/apache/dubbo/common/timer/HashedWheelTimerTest.java
test_class.identifier: HashedWheelTimerTest
test_case.body: @Test
      public void newTimeout() throws InterruptedException {
          final Timer timer = newTimer();
          for (int i = 0; i < 10; i++) {
              timer.newTimeout(new PrintTask(), 1, TimeUnit.SECONDS);
              Thread.sleep(1000);
          }
          Thread.sleep(5000);
      }
test_case.class_method_signature: HashedWheelTimerTest.newTimeout()
test_case.full_signature: @Test public void newTimeout()
test_case.identifier: newTimeout
test_case.invocations: newTimer newTimeout sleep sleep
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void newTimeout()
focal_class.declarator: NAME = "hased"
focal_class.modifier: public static final
focal_class.original_string: public static final String NAME = "hased";
focal_class.type: String
focal_class.var_name: NAME
focal_class.declarator: logger = LoggerFactory.getLogger(HashedWheelTimer.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(HashedWheelTimer.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: INSTANCE_COUNTER = new AtomicInteger()
focal_class.modifier: private static final
focal_class.original_string: private static final AtomicInteger INSTANCE_COUNTER = new AtomicInteger();
focal_class.type: AtomicInteger
focal_class.var_name: INSTANCE_COUNTER
focal_class.declarator: WARNED_TOO_MANY_INSTANCES = new AtomicBoolean()
focal_class.modifier: private static final
focal_class.original_string: private static final AtomicBoolean WARNED_TOO_MANY_INSTANCES = new AtomicBoolean();
focal_class.type: AtomicBoolean
focal_class.var_name: WARNED_TOO_MANY_INSTANCES
focal_class.declarator: INSTANCE_COUNT_LIMIT = 64
focal_class.modifier: private static final
focal_class.original_string: private static final int INSTANCE_COUNT_LIMIT = 64;
focal_class.type: int
focal_class.var_name: INSTANCE_COUNT_LIMIT
focal_class.declarator: WORKER_STATE_UPDATER =
              AtomicIntegerFieldUpdater.newUpdater(HashedWheelTimer.class, "workerState")
focal_class.modifier: private static final
focal_class.original_string: private static final AtomicIntegerFieldUpdater<HashedWheelTimer> WORKER_STATE_UPDATER =
              AtomicIntegerFieldUpdater.newUpdater(HashedWheelTimer.class, "workerState");
focal_class.type: AtomicIntegerFieldUpdater<HashedWheelTimer>
focal_class.var_name: WORKER_STATE_UPDATER
focal_class.declarator: worker = new Worker()
focal_class.modifier: private final
focal_class.original_string: private final Worker worker = new Worker();
focal_class.type: Worker
focal_class.var_name: worker
focal_class.declarator: workerThread
focal_class.modifier: private final
focal_class.original_string: private final Thread workerThread;
focal_class.type: Thread
focal_class.var_name: workerThread
focal_class.declarator: WORKER_STATE_INIT = 0
focal_class.modifier: private static final
focal_class.original_string: private static final int WORKER_STATE_INIT = 0;
focal_class.type: int
focal_class.var_name: WORKER_STATE_INIT
focal_class.declarator: WORKER_STATE_STARTED = 1
focal_class.modifier: private static final
focal_class.original_string: private static final int WORKER_STATE_STARTED = 1;
focal_class.type: int
focal_class.var_name: WORKER_STATE_STARTED
focal_class.declarator: WORKER_STATE_SHUTDOWN = 2
focal_class.modifier: private static final
focal_class.original_string: private static final int WORKER_STATE_SHUTDOWN = 2;
focal_class.type: int
focal_class.var_name: WORKER_STATE_SHUTDOWN
focal_class.declarator: workerState
focal_class.modifier: @SuppressWarnings({"unused", "FieldMayBeFinal"})
      private volatile
focal_class.original_string: @SuppressWarnings({"unused", "FieldMayBeFinal"})
      private volatile int workerState;
focal_class.type: int
focal_class.var_name: workerState
focal_class.declarator: tickDuration
focal_class.modifier: private final
focal_class.original_string: private final long tickDuration;
focal_class.type: long
focal_class.var_name: tickDuration
focal_class.declarator: wheel
focal_class.modifier: private final
focal_class.original_string: private final HashedWheelBucket[] wheel;
focal_class.type: HashedWheelBucket[]
focal_class.var_name: wheel
focal_class.declarator: mask
focal_class.modifier: private final
focal_class.original_string: private final int mask;
focal_class.type: int
focal_class.var_name: mask
focal_class.declarator: startTimeInitialized = new CountDownLatch(1)
focal_class.modifier: private final
focal_class.original_string: private final CountDownLatch startTimeInitialized = new CountDownLatch(1);
focal_class.type: CountDownLatch
focal_class.var_name: startTimeInitialized
focal_class.declarator: timeouts = new LinkedBlockingQueue<>()
focal_class.modifier: private final
focal_class.original_string: private final Queue<HashedWheelTimeout> timeouts = new LinkedBlockingQueue<>();
focal_class.type: Queue<HashedWheelTimeout>
focal_class.var_name: timeouts
focal_class.declarator: cancelledTimeouts = new LinkedBlockingQueue<>()
focal_class.modifier: private final
focal_class.original_string: private final Queue<HashedWheelTimeout> cancelledTimeouts = new LinkedBlockingQueue<>();
focal_class.type: Queue<HashedWheelTimeout>
focal_class.var_name: cancelledTimeouts
focal_class.declarator: pendingTimeouts = new AtomicLong(0)
focal_class.modifier: private final
focal_class.original_string: private final AtomicLong pendingTimeouts = new AtomicLong(0);
focal_class.type: AtomicLong
focal_class.var_name: pendingTimeouts
focal_class.declarator: maxPendingTimeouts
focal_class.modifier: private final
focal_class.original_string: private final long maxPendingTimeouts;
focal_class.type: long
focal_class.var_name: maxPendingTimeouts
focal_class.declarator: startTime
focal_class.modifier: private volatile
focal_class.original_string: private volatile long startTime;
focal_class.type: long
focal_class.var_name: startTime
focal_class.file: dubbo-common/src/main/java/org/apache/dubbo/common/timer/HashedWheelTimer.java
focal_class.identifier: HashedWheelTimer
focal_class.interfaces: implements Timer
focal_class.class_method_signature: HashedWheelTimer.HashedWheelTimer()
focal_class.full_signature: public  HashedWheelTimer()
focal_class.identifier: HashedWheelTimer
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  HashedWheelTimer()
focal_class.class_method_signature: HashedWheelTimer.HashedWheelTimer(long tickDuration, TimeUnit unit)
focal_class.full_signature: public  HashedWheelTimer(long tickDuration, TimeUnit unit)
focal_class.identifier: HashedWheelTimer
focal_class.modifiers: public
focal_class.parameters: (long tickDuration, TimeUnit unit)
focal_class.signature:  HashedWheelTimer(long tickDuration, TimeUnit unit)
focal_class.class_method_signature: HashedWheelTimer.HashedWheelTimer(long tickDuration, TimeUnit unit, int ticksPerWheel)
focal_class.full_signature: public  HashedWheelTimer(long tickDuration, TimeUnit unit, int ticksPerWheel)
focal_class.identifier: HashedWheelTimer
focal_class.modifiers: public
focal_class.parameters: (long tickDuration, TimeUnit unit, int ticksPerWheel)
focal_class.signature:  HashedWheelTimer(long tickDuration, TimeUnit unit, int ticksPerWheel)
focal_class.class_method_signature: HashedWheelTimer.HashedWheelTimer(ThreadFactory threadFactory)
focal_class.full_signature: public  HashedWheelTimer(ThreadFactory threadFactory)
focal_class.identifier: HashedWheelTimer
focal_class.modifiers: public
focal_class.parameters: (ThreadFactory threadFactory)
focal_class.signature:  HashedWheelTimer(ThreadFactory threadFactory)
focal_class.class_method_signature: HashedWheelTimer.HashedWheelTimer(
              ThreadFactory threadFactory, long tickDuration, TimeUnit unit)
focal_class.full_signature: public  HashedWheelTimer(
              ThreadFactory threadFactory, long tickDuration, TimeUnit unit)
focal_class.identifier: HashedWheelTimer
focal_class.modifiers: public
focal_class.parameters: (
              ThreadFactory threadFactory, long tickDuration, TimeUnit unit)
focal_class.signature:  HashedWheelTimer(
              ThreadFactory threadFactory, long tickDuration, TimeUnit unit)
focal_class.class_method_signature: HashedWheelTimer.HashedWheelTimer(
              ThreadFactory threadFactory,
              long tickDuration, TimeUnit unit, int ticksPerWheel)
focal_class.full_signature: public  HashedWheelTimer(
              ThreadFactory threadFactory,
              long tickDuration, TimeUnit unit, int ticksPerWheel)
focal_class.identifier: HashedWheelTimer
focal_class.modifiers: public
focal_class.parameters: (
              ThreadFactory threadFactory,
              long tickDuration, TimeUnit unit, int ticksPerWheel)
focal_class.signature:  HashedWheelTimer(
              ThreadFactory threadFactory,
              long tickDuration, TimeUnit unit, int ticksPerWheel)
focal_class.class_method_signature: HashedWheelTimer.HashedWheelTimer(
              ThreadFactory threadFactory,
              long tickDuration, TimeUnit unit, int ticksPerWheel,
              long maxPendingTimeouts)
focal_class.full_signature: public  HashedWheelTimer(
              ThreadFactory threadFactory,
              long tickDuration, TimeUnit unit, int ticksPerWheel,
              long maxPendingTimeouts)
focal_class.identifier: HashedWheelTimer
focal_class.modifiers: public
focal_class.parameters: (
              ThreadFactory threadFactory,
              long tickDuration, TimeUnit unit, int ticksPerWheel,
              long maxPendingTimeouts)
focal_class.signature:  HashedWheelTimer(
              ThreadFactory threadFactory,
              long tickDuration, TimeUnit unit, int ticksPerWheel,
              long maxPendingTimeouts)
focal_class.class_method_signature: HashedWheelTimer.finalize()
focal_class.full_signature: @Override protected void finalize()
focal_class.identifier: finalize
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void finalize()
focal_class.class_method_signature: HashedWheelTimer.createWheel(int ticksPerWheel)
focal_class.full_signature: private static HashedWheelBucket[] createWheel(int ticksPerWheel)
focal_class.identifier: createWheel
focal_class.modifiers: private static
focal_class.parameters: (int ticksPerWheel)
focal_class.return: HashedWheelBucket[]
focal_class.signature: HashedWheelBucket[] createWheel(int ticksPerWheel)
focal_class.class_method_signature: HashedWheelTimer.normalizeTicksPerWheel(int ticksPerWheel)
focal_class.full_signature: private static int normalizeTicksPerWheel(int ticksPerWheel)
focal_class.identifier: normalizeTicksPerWheel
focal_class.modifiers: private static
focal_class.parameters: (int ticksPerWheel)
focal_class.return: int
focal_class.signature: int normalizeTicksPerWheel(int ticksPerWheel)
focal_class.class_method_signature: HashedWheelTimer.start()
focal_class.full_signature: public void start()
focal_class.identifier: start
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void start()
focal_class.class_method_signature: HashedWheelTimer.stop()
focal_class.full_signature: @Override public Set<Timeout> stop()
focal_class.identifier: stop
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Set<Timeout>
focal_class.signature: Set<Timeout> stop()
focal_class.class_method_signature: HashedWheelTimer.isStop()
focal_class.full_signature: @Override public boolean isStop()
focal_class.identifier: isStop
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isStop()
focal_class.class_method_signature: HashedWheelTimer.newTimeout(TimerTask task, long delay, TimeUnit unit)
focal_class.full_signature: @Override public Timeout newTimeout(TimerTask task, long delay, TimeUnit unit)
focal_class.identifier: newTimeout
focal_class.modifiers: @Override public
focal_class.parameters: (TimerTask task, long delay, TimeUnit unit)
focal_class.return: Timeout
focal_class.signature: Timeout newTimeout(TimerTask task, long delay, TimeUnit unit)
focal_class.class_method_signature: HashedWheelTimer.pendingTimeouts()
focal_class.full_signature: public long pendingTimeouts()
focal_class.identifier: pendingTimeouts
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long pendingTimeouts()
focal_class.class_method_signature: HashedWheelTimer.reportTooManyInstances()
focal_class.full_signature: private static void reportTooManyInstances()
focal_class.identifier: reportTooManyInstances
focal_class.modifiers: private static
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void reportTooManyInstances()
focal_class.class_method_signature: HashedWheelTimer.isWindows()
focal_class.full_signature: private boolean isWindows()
focal_class.identifier: isWindows
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isWindows()
focal_method.body: @Override
      public Timeout newTimeout(TimerTask task, long delay, TimeUnit unit) {
          if (task == null) {
              throw new NullPointerException("task");
          }
          if (unit == null) {
              throw new NullPointerException("unit");
          }
  
          long pendingTimeoutsCount = pendingTimeouts.incrementAndGet();
  
          if (maxPendingTimeouts > 0 && pendingTimeoutsCount > maxPendingTimeouts) {
              pendingTimeouts.decrementAndGet();
              throw new RejectedExecutionException("Number of pending timeouts ("
                      + pendingTimeoutsCount + ") is greater than or equal to maximum allowed pending "
                      + "timeouts (" + maxPendingTimeouts + ")");
          }
  
          start();
  
          // Add the timeout to the timeout queue which will be processed on the next tick.
          // During processing all the queued HashedWheelTimeouts will be added to the correct HashedWheelBucket.
          long deadline = System.nanoTime() + unit.toNanos(delay) - startTime;
  
          // Guard against overflow.
          if (delay > 0 && deadline < 0) {
              deadline = Long.MAX_VALUE;
          }
          HashedWheelTimeout timeout = new HashedWheelTimeout(this, task, deadline);
          timeouts.add(timeout);
          return timeout;
      }
focal_method.class_method_signature: HashedWheelTimer.newTimeout(TimerTask task, long delay, TimeUnit unit)
focal_method.full_signature: @Override public Timeout newTimeout(TimerTask task, long delay, TimeUnit unit)
focal_method.identifier: newTimeout
focal_method.invocations: incrementAndGet decrementAndGet start nanoTime toNanos add
focal_method.modifiers: @Override public
focal_method.parameters: (TimerTask task, long delay, TimeUnit unit)
focal_method.return: Timeout
focal_method.signature: Timeout newTimeout(TimerTask task, long delay, TimeUnit unit)