java.util.concurrent.ScheduledThreadPoolExecutor.getPoolSize()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(87)

本文整理了Java中java.util.concurrent.ScheduledThreadPoolExecutor.getPoolSize()方法的一些代码示例,展示了ScheduledThreadPoolExecutor.getPoolSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScheduledThreadPoolExecutor.getPoolSize()方法的具体详情如下:
包路径:java.util.concurrent.ScheduledThreadPoolExecutor
类名称:ScheduledThreadPoolExecutor
方法名:getPoolSize

ScheduledThreadPoolExecutor.getPoolSize介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-framework

/**
 * Return the current pool size.
 * <p>Requires an underlying {@link ScheduledThreadPoolExecutor}.
 * @see #getScheduledThreadPoolExecutor()
 * @see java.util.concurrent.ScheduledThreadPoolExecutor#getPoolSize()
 */
public int getPoolSize() {
  if (this.scheduledExecutor == null) {
    // Not initialized yet: assume initial pool size.
    return this.poolSize;
  }
  return getScheduledThreadPoolExecutor().getPoolSize();
}

代码示例来源:origin: org.springframework/spring-context

/**
 * Return the current pool size.
 * <p>Requires an underlying {@link ScheduledThreadPoolExecutor}.
 * @see #getScheduledThreadPoolExecutor()
 * @see java.util.concurrent.ScheduledThreadPoolExecutor#getPoolSize()
 */
public int getPoolSize() {
  if (this.scheduledExecutor == null) {
    // Not initialized yet: assume initial pool size.
    return this.poolSize;
  }
  return getScheduledThreadPoolExecutor().getPoolSize();
}

代码示例来源:origin: gravitee-io/gravitee-gateway

public int getPoolSize() {
  return ApiKeysServiceHandler.this.executorService.getPoolSize();
}

代码示例来源:origin: gravitee-io/gravitee-gateway

public int getPoolSize() {
  return SubscriptionsServiceHandler.this.executorService.getPoolSize();
}

代码示例来源:origin: i2p/i2p.i2p

private String debug() {
    return
      " Pool: " + _name +
      " Active: " + _executor.getActiveCount() + '/' + _executor.getPoolSize() +
      " Completed: " + _executor.getCompletedTaskCount() +
      " Queued: " + _executor.getQueue().size();
  }
}

代码示例来源:origin: i2p/i2p.i2p

/** warning - slow */
private String debug() {
  _executor.purge();  // Remove cancelled tasks from the queue so we get a good queue size stat
  return
    " Pool: " + _name +
    " Active: " + _executor.getActiveCount() + '/' + _executor.getPoolSize() +
    " Completed: " + _executor.getCompletedTaskCount() +
    " Queued: " + _executor.getQueue().size();
}

代码示例来源:origin: Comcast/cmb

@Override
public int getAsyncWorkerPoolSize() {
  return CMBControllerServlet.workerPool.getPoolSize();
}

代码示例来源:origin: io.gravitee.gateway.services/gravitee-gateway-services-apikeyscache

public int getPoolSize() {
  return ApiKeysServiceHandler.this.executorService.getPoolSize();
}

代码示例来源:origin: apache/activemq-artemis

public int getCurrentThreads() {
  return super.getPoolSize();
}

代码示例来源:origin: apache/activemq-artemis

public int getCurrentThreads() {
  return super.getPoolSize();
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

public int getCurrentThreads() {
  return super.getPoolSize();
}

代码示例来源:origin: org.apache.felix/org.apache.felix.healthcheck.core

public int getPoolSize() {
  return this.executor.getPoolSize();
}

代码示例来源:origin: io.gravitee.gateway.services/gravitee-gateway-services-subscriptions-cache

public int getPoolSize() {
  return SubscriptionsServiceHandler.this.executorService.getPoolSize();
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.playframework/play

static void resetClassloaders() {
  Thread[] executorThreads = new Thread[executor.getPoolSize()];
  Thread.enumerate(executorThreads);
  for (Thread thread : executorThreads) {
    if (thread != null && thread.getContextClassLoader() instanceof ApplicationClassloader)
      thread.setContextClassLoader(ClassLoader.getSystemClassLoader());
  }
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Return the current pool size.
 * <p>Requires an underlying {@link ScheduledThreadPoolExecutor}.
 * @see #getScheduledThreadPoolExecutor()
 * @see java.util.concurrent.ScheduledThreadPoolExecutor#getPoolSize()
 */
public int getPoolSize() {
  if (this.scheduledExecutor == null) {
    // Not initialized yet: assume initial pool size.
    return this.poolSize;
  }
  return getScheduledThreadPoolExecutor().getPoolSize();
}

代码示例来源:origin: com.github.dimovelev/metrics-sampler-extension-base

@Override
  public Map<String, Object> getStats() {
    final String prefix = "thread-pools." + getName() + ".";
    final Map<String, Object> result = new HashMap<>();
    result.put(prefix + "activeCount", executorService.getActiveCount());
    result.put(prefix + "poolSize", executorService.getPoolSize());
    result.put(prefix + "completedTaskCount", executorService.getCompletedTaskCount());
    return result;
  }
}

代码示例来源:origin: dimovelev/metrics-sampler

@Override
  public Map<String, Object> getStats() {
    final String prefix = "thread-pools." + getName() + ".";
    final Map<String, Object> result = new HashMap<>();
    result.put(prefix + "activeCount", executorService.getActiveCount());
    result.put(prefix + "poolSize", executorService.getPoolSize());
    result.put(prefix + "completedTaskCount", executorService.getCompletedTaskCount());
    return result;
  }
}

代码示例来源:origin: actframework/actframework

@Command(value = "act.job.scheduler", help = "Show Job manager scheduler status")
public String getSchedulerStatus(JobManager jobManager) {
  ScheduledThreadPoolExecutor executor = jobManager.executor();
  JSONObject json = new JSONObject();
  json.put("is terminating", executor.isTerminating());
  json.put("is terminated", executor.isTerminated());
  json.put("is shutdown", executor.isShutdown());
  json.put("# of runnable in the queue", executor.getQueue().size());
  json.put("active count", executor.getActiveCount());
  json.put("# of completed tasks", executor.getActiveCount());
  json.put("core pool size", executor.getCorePoolSize());
  json.put("pool size", executor.getPoolSize());
  return json.toJSONString();
}

代码示例来源:origin: org.actframework/act

@Command(value = "act.job.scheduler", help = "Show Job manager scheduler status")
public String getSchedulerStatus(JobManager jobManager) {
  ScheduledThreadPoolExecutor executor = jobManager.executor();
  JSONObject json = new JSONObject();
  json.put("is terminating", executor.isTerminating());
  json.put("is terminated", executor.isTerminated());
  json.put("is shutdown", executor.isShutdown());
  json.put("# of runnable in the queue", executor.getQueue().size());
  json.put("active count", executor.getActiveCount());
  json.put("# of completed tasks", executor.getActiveCount());
  json.put("core pool size", executor.getCorePoolSize());
  json.put("pool size", executor.getPoolSize());
  return json.toJSONString();
}

代码示例来源:origin: fujitsu-pio/io

/**
 * ExecutorServiceの起動_終了テスト.
 */
@Test
@Ignore
public void ExecutorServiceの起動_終了テスト() {
  RepairServiceLauncher launcher = new RepairServiceLauncher();
  assertThat(launcher.executor.getPoolSize(), is(1));
  assertThat(launcher.executor.getTaskCount(), is(1L));
  launcher.shutdown();
  assertThat(launcher.executor.isTerminated(), is(true));
  assertThat(launcher.executor.isShutdown(), is(true));
}

相关文章

微信公众号

最新文章

更多

ScheduledThreadPoolExecutor类方法