test_class.declarator: statItem
test_class.modifier: private
test_class.original_string: private StatItem statItem;
test_class.type: StatItem
test_class.var_name: statItem
test_class.file: dubbo-rpc/dubbo-rpc-api/src/test/java/com/alibaba/dubbo/rpc/filter/tps/StatItemTest.java
test_class.identifier: StatItemTest
test_case.body: @Test
      public void testIsAllowable() throws Exception {
          statItem = new StatItem("test", 5, 1000L);
          long lastResetTime = statItem.getLastResetTime();
          assertEquals(true, statItem.isAllowable());
          Thread.sleep(1100L);
          assertEquals(true, statItem.isAllowable());
          assertTrue(lastResetTime != statItem.getLastResetTime());
          assertEquals(4, statItem.getToken());
      }
test_case.class_method_signature: StatItemTest.testIsAllowable()
test_case.full_signature: @Test public void testIsAllowable()
test_case.identifier: testIsAllowable
test_case.invocations: getLastResetTime assertEquals isAllowable sleep assertEquals isAllowable assertTrue getLastResetTime assertEquals getToken
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testIsAllowable()
focal_class.declarator: name
focal_class.modifier: private
focal_class.original_string: private String name;
focal_class.type: String
focal_class.var_name: name
focal_class.declarator: lastResetTime
focal_class.modifier: private
focal_class.original_string: private long lastResetTime;
focal_class.type: long
focal_class.var_name: lastResetTime
focal_class.declarator: interval
focal_class.modifier: private
focal_class.original_string: private long interval;
focal_class.type: long
focal_class.var_name: interval
focal_class.declarator: token
focal_class.modifier: private
focal_class.original_string: private AtomicInteger token;
focal_class.type: AtomicInteger
focal_class.var_name: token
focal_class.declarator: rate
focal_class.modifier: private
focal_class.original_string: private int rate;
focal_class.type: int
focal_class.var_name: rate
focal_class.file: dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/filter/tps/StatItem.java
focal_class.identifier: StatItem
focal_class.class_method_signature: StatItem.StatItem(String name, int rate, long interval)
focal_class.full_signature:   StatItem(String name, int rate, long interval)
focal_class.identifier: StatItem
focal_class.parameters: (String name, int rate, long interval)
focal_class.signature:  StatItem(String name, int rate, long interval)
focal_class.class_method_signature: StatItem.isAllowable()
focal_class.full_signature: public boolean isAllowable()
focal_class.identifier: isAllowable
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isAllowable()
focal_class.class_method_signature: StatItem.getLastResetTime()
focal_class.full_signature:  long getLastResetTime()
focal_class.identifier: getLastResetTime
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getLastResetTime()
focal_class.class_method_signature: StatItem.getToken()
focal_class.full_signature:  int getToken()
focal_class.identifier: getToken
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getToken()
focal_class.class_method_signature: StatItem.toString()
focal_class.full_signature: @Override public String toString()
focal_class.identifier: toString
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_method.body: public boolean isAllowable() {
          long now = System.currentTimeMillis();
          if (now > lastResetTime + interval) {
              token.set(rate);
              lastResetTime = now;
          }
  
          int value = token.get();
          boolean flag = false;
          while (value > 0 && !flag) {
              flag = token.compareAndSet(value, value - 1);
              value = token.get();
          }
  
          return flag;
      }
focal_method.class_method_signature: StatItem.isAllowable()
focal_method.full_signature: public boolean isAllowable()
focal_method.identifier: isAllowable
focal_method.invocations: currentTimeMillis set get compareAndSet get
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: boolean
focal_method.signature: boolean isAllowable()