test_class.declarator: URL = new URL("dubbo", "localhost", 8080)
test_class.modifier: private static final
test_class.original_string: private static final URL URL = new URL("dubbo", "localhost", 8080);
test_class.type: URL
test_class.var_name: URL
test_class.file: dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/eager/EagerThreadPoolExecutorTest.java
test_class.identifier: EagerThreadPoolExecutorTest
test_case.body: @Test
      public void testEagerThreadPool() throws Exception {
          String name = "eager-tf";
          int queues = 5;
          int cores = 5;
          int threads = 10;
          // alive 1 second
          long alive = 1000;
  
          //init queue and executor
          TaskQueue<Runnable> taskQueue = new TaskQueue<Runnable>(queues);
          final EagerThreadPoolExecutor executor = new EagerThreadPoolExecutor(cores,
                  threads,
                  alive,
                  TimeUnit.MILLISECONDS,
                  taskQueue,
                  new NamedThreadFactory(name, true),
                  new AbortPolicyWithReport(name, URL));
          taskQueue.setExecutor(executor);
  
          for (int i = 0; i < 15; i++) {
              Thread.sleep(50);
              executor.execute(new Runnable() {
                  @Override
                  public void run() {
                      System.out.println("thread number in current pool：" + executor.getPoolSize() + ",  task number in task queue：" + executor.getQueue()
                              .size() + " executor size: " + executor.getPoolSize());
                      try {
                          Thread.sleep(1000);
                      } catch (InterruptedException e) {
                          e.printStackTrace();
                      }
                  }
              });
          }
          Thread.sleep(5000);
          // cores theads are all alive.
          Assertions.assertEquals(executor.getPoolSize(), cores, "more than cores threads alive!");
      }
test_case.class_method_signature: EagerThreadPoolExecutorTest.testEagerThreadPool()
test_case.full_signature: @Test public void testEagerThreadPool()
test_case.identifier: testEagerThreadPool
test_case.invocations: setExecutor sleep execute println tPoolSize() size ueue() getPoolSize sleep printStackTrace sleep assertEquals getPoolSize
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testEagerThreadPool()
focal_class.declarator: submittedTaskCount = new AtomicInteger(0)
focal_class.modifier: private final
focal_class.original_string: private final AtomicInteger submittedTaskCount = new AtomicInteger(0);
focal_class.type: AtomicInteger
focal_class.var_name: submittedTaskCount
focal_class.file: dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/support/eager/EagerThreadPoolExecutor.java
focal_class.identifier: EagerThreadPoolExecutor
focal_class.class_method_signature: EagerThreadPoolExecutor.EagerThreadPoolExecutor(int corePoolSize,
                                     int maximumPoolSize,
                                     long keepAliveTime,
                                     TimeUnit unit, TaskQueue<Runnable> workQueue,
                                     ThreadFactory threadFactory,
                                     RejectedExecutionHandler handler)
focal_class.full_signature: public  EagerThreadPoolExecutor(int corePoolSize,
                                     int maximumPoolSize,
                                     long keepAliveTime,
                                     TimeUnit unit, TaskQueue<Runnable> workQueue,
                                     ThreadFactory threadFactory,
                                     RejectedExecutionHandler handler)
focal_class.identifier: EagerThreadPoolExecutor
focal_class.modifiers: public
focal_class.parameters: (int corePoolSize,
                                     int maximumPoolSize,
                                     long keepAliveTime,
                                     TimeUnit unit, TaskQueue<Runnable> workQueue,
                                     ThreadFactory threadFactory,
                                     RejectedExecutionHandler handler)
focal_class.signature:  EagerThreadPoolExecutor(int corePoolSize,
                                     int maximumPoolSize,
                                     long keepAliveTime,
                                     TimeUnit unit, TaskQueue<Runnable> workQueue,
                                     ThreadFactory threadFactory,
                                     RejectedExecutionHandler handler)
focal_class.class_method_signature: EagerThreadPoolExecutor.getSubmittedTaskCount()
focal_class.full_signature: public int getSubmittedTaskCount()
focal_class.identifier: getSubmittedTaskCount
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getSubmittedTaskCount()
focal_class.class_method_signature: EagerThreadPoolExecutor.afterExecute(Runnable r, Throwable t)
focal_class.full_signature: @Override protected void afterExecute(Runnable r, Throwable t)
focal_class.identifier: afterExecute
focal_class.modifiers: @Override protected
focal_class.parameters: (Runnable r, Throwable t)
focal_class.return: void
focal_class.signature: void afterExecute(Runnable r, Throwable t)
focal_class.class_method_signature: EagerThreadPoolExecutor.execute(Runnable command)
focal_class.full_signature: @Override public void execute(Runnable command)
focal_class.identifier: execute
focal_class.modifiers: @Override public
focal_class.parameters: (Runnable command)
focal_class.return: void
focal_class.signature: void execute(Runnable command)
focal_class.superclass: extends ThreadPoolExecutor
focal_method.body: @Override
      public void execute(Runnable command) {
          if (command == null) {
              throw new NullPointerException();
          }
          // do not increment in method beforeExecute!
          submittedTaskCount.incrementAndGet();
          try {
              super.execute(command);
          } catch (RejectedExecutionException rx) {
              // retry to offer the task into queue.
              final TaskQueue queue = (TaskQueue) super.getQueue();
              try {
                  if (!queue.retryOffer(command, 0, TimeUnit.MILLISECONDS)) {
                      submittedTaskCount.decrementAndGet();
                      throw new RejectedExecutionException("Queue capacity is full.", rx);
                  }
              } catch (InterruptedException x) {
                  submittedTaskCount.decrementAndGet();
                  throw new RejectedExecutionException(x);
              }
          } catch (Throwable t) {
              // decrease any way
              submittedTaskCount.decrementAndGet();
              throw t;
          }
      }
focal_method.class_method_signature: EagerThreadPoolExecutor.execute(Runnable command)
focal_method.full_signature: @Override public void execute(Runnable command)
focal_method.identifier: execute
focal_method.invocations: incrementAndGet execute getQueue retryOffer decrementAndGet decrementAndGet decrementAndGet
focal_method.modifiers: @Override public
focal_method.parameters: (Runnable command)
focal_method.return: void
focal_method.signature: void execute(Runnable command)