test_class.declarator: activeLimitFilter = new ActiveLimitFilter()
test_class.original_string: ActiveLimitFilter activeLimitFilter = new ActiveLimitFilter();
test_class.type: ActiveLimitFilter
test_class.var_name: activeLimitFilter
test_class.file: dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ActiveLimitFilterTest.java
test_class.identifier: ActiveLimitFilterTest
test_case.body: @Test
      public void testInvokeGreaterActives() {
          AtomicInteger count = new AtomicInteger(0);
          URL url = URL.valueOf("test://test:11/test?accesslog=true&group=dubbo&version=1.1&actives=1&timeout=1");
          final Invoker<ActiveLimitFilterTest> invoker = new BlockMyInvoker<ActiveLimitFilterTest>(url, 100);
          final Invocation invocation = new MockInvocation();
          final CountDownLatch latch = new CountDownLatch(1);
          for (int i = 0; i < 100; i++) {
              Thread thread = new Thread(new Runnable() {
  
                  public void run() {
                      try {
                          latch.await();
                      } catch (InterruptedException e) {
                          e.printStackTrace();
                      }
                      for (int i = 0; i < 100; i++) {
                          try {
                              activeLimitFilter.invoke(invoker, invocation);
                          } catch (RpcException expected) {
                              count.incrementAndGet();
                          }
                      }
                  }
              });
              thread.start();
          }
          latch.countDown();
  
          try {
              Thread.sleep(1000);
          } catch (InterruptedException e) {
              e.printStackTrace();
          }
          assertNotSame(0, count.intValue());
      }
test_case.class_method_signature: ActiveLimitFilterTest.testInvokeGreaterActives()
test_case.full_signature: @Test public void testInvokeGreaterActives()
test_case.identifier: testInvokeGreaterActives
test_case.invocations: valueOf await printStackTrace invoke incrementAndGet start countDown sleep printStackTrace assertNotSame intValue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testInvokeGreaterActives()
focal_class.declarator: ACTIVELIMIT_FILTER_START_TIME = "activelimit_filter_start_time"
focal_class.modifier: private static final
focal_class.original_string: private static final String ACTIVELIMIT_FILTER_START_TIME = "activelimit_filter_start_time";
focal_class.type: String
focal_class.var_name: ACTIVELIMIT_FILTER_START_TIME
focal_class.file: dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ActiveLimitFilter.java
focal_class.identifier: ActiveLimitFilter
focal_class.interfaces: implements Filter, Filter.Listener
focal_class.class_method_signature: ActiveLimitFilter.invoke(Invoker<?> invoker, Invocation invocation)
focal_class.full_signature: @Override public Result invoke(Invoker<?> invoker, Invocation invocation)
focal_class.identifier: invoke
focal_class.modifiers: @Override public
focal_class.parameters: (Invoker<?> invoker, Invocation invocation)
focal_class.return: Result
focal_class.signature: Result invoke(Invoker<?> invoker, Invocation invocation)
focal_class.class_method_signature: ActiveLimitFilter.onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation)
focal_class.full_signature: @Override public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation)
focal_class.identifier: onResponse
focal_class.modifiers: @Override public
focal_class.parameters: (Result appResponse, Invoker<?> invoker, Invocation invocation)
focal_class.return: void
focal_class.signature: void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation)
focal_class.class_method_signature: ActiveLimitFilter.onError(Throwable t, Invoker<?> invoker, Invocation invocation)
focal_class.full_signature: @Override public void onError(Throwable t, Invoker<?> invoker, Invocation invocation)
focal_class.identifier: onError
focal_class.modifiers: @Override public
focal_class.parameters: (Throwable t, Invoker<?> invoker, Invocation invocation)
focal_class.return: void
focal_class.signature: void onError(Throwable t, Invoker<?> invoker, Invocation invocation)
focal_class.class_method_signature: ActiveLimitFilter.getElapsed(Invocation invocation)
focal_class.full_signature: private long getElapsed(Invocation invocation)
focal_class.identifier: getElapsed
focal_class.modifiers: private
focal_class.parameters: (Invocation invocation)
focal_class.return: long
focal_class.signature: long getElapsed(Invocation invocation)
focal_class.class_method_signature: ActiveLimitFilter.notifyFinish(final RpcStatus rpcStatus, int max)
focal_class.full_signature: private void notifyFinish(final RpcStatus rpcStatus, int max)
focal_class.identifier: notifyFinish
focal_class.modifiers: private
focal_class.parameters: (final RpcStatus rpcStatus, int max)
focal_class.return: void
focal_class.signature: void notifyFinish(final RpcStatus rpcStatus, int max)
focal_method.body: @Override
      public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
          URL url = invoker.getUrl();
          String methodName = invocation.getMethodName();
          int max = invoker.getUrl().getMethodParameter(methodName, ACTIVES_KEY, 0);
          final RpcStatus rpcStatus = RpcStatus.getStatus(invoker.getUrl(), invocation.getMethodName());
          if (!RpcStatus.beginCount(url, methodName, max)) {
              long timeout = invoker.getUrl().getMethodParameter(invocation.getMethodName(), TIMEOUT_KEY, 0);
              long start = System.currentTimeMillis();
              long remain = timeout;
              synchronized (rpcStatus) {
                  while (!RpcStatus.beginCount(url, methodName, max)) {
                      try {
                          rpcStatus.wait(remain);
                      } catch (InterruptedException e) {
                          // ignore
                      }
                      long elapsed = System.currentTimeMillis() - start;
                      remain = timeout - elapsed;
                      if (remain <= 0) {
                          throw new RpcException(RpcException.LIMIT_EXCEEDED_EXCEPTION,
                                  "Waiting concurrent invoke timeout in client-side for service:  " +
                                          invoker.getInterface().getName() + ", method: " + invocation.getMethodName() +
                                          ", elapsed: " + elapsed + ", timeout: " + timeout + ". concurrent invokes: " +
                                          rpcStatus.getActive() + ". max concurrent invoke limit: " + max);
                      }
                  }
              }
          }
  
          invocation.put(ACTIVELIMIT_FILTER_START_TIME, System.currentTimeMillis());
  
          return invoker.invoke(invocation);
      }
focal_method.class_method_signature: ActiveLimitFilter.invoke(Invoker<?> invoker, Invocation invocation)
focal_method.full_signature: @Override public Result invoke(Invoker<?> invoker, Invocation invocation)
focal_method.identifier: invoke
focal_method.invocations: getUrl getMethodName getMethodParameter getUrl getStatus getUrl getMethodName beginCount getMethodParameter getUrl getMethodName currentTimeMillis beginCount wait currentTimeMillis getName getInterface getMethodName getActive put currentTimeMillis invoke
focal_method.modifiers: @Override public
focal_method.parameters: (Invoker<?> invoker, Invocation invocation)
focal_method.return: Result
focal_method.signature: Result invoke(Invoker<?> invoker, Invocation invocation)