Java Code Examples for java.util.concurrent.ThreadPoolExecutor#getLargestPoolSize()

The following examples show how to use java.util.concurrent.ThreadPoolExecutor#getLargestPoolSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeepAilveTest.java    From tomee with Apache License 2.0 6 votes vote down vote up
private void print(final ThreadPoolExecutor pool) {
    System.out.println("==========================================");
    final int activeCount = pool.getActiveCount();
    System.out.println("activeCount = " + activeCount);
    final int corePoolSize = pool.getCorePoolSize();
    System.out.println("corePoolSize = " + corePoolSize);
    final int largestPoolSize = pool.getLargestPoolSize();
    System.out.println("largestPoolSize = " + largestPoolSize);
    final int maximumPoolSize = pool.getMaximumPoolSize();
    System.out.println("maximumPoolSize = " + maximumPoolSize);
    final int poolSize = pool.getPoolSize();
    System.out.println("poolSize = " + poolSize);
    final int queueSize = pool.getQueue().size();
    System.out.println("queueSize = " + queueSize);
    final long taskCount = pool.getTaskCount();
    System.out.println("taskCount = " + taskCount);
    System.out.println("==========================================");
}
 
Example 2
Source File: ExecutorStateEvent.java    From amazon-kinesis-client with Apache License 2.0 5 votes vote down vote up
ExecutorStateEvent(ExecutorService executor, LeaseCoordinator leaseCoordinator) {
    if (executor instanceof ThreadPoolExecutor) {
        this.isThreadPoolExecutor = true;

        ThreadPoolExecutor ex = (ThreadPoolExecutor) executor;
        this.executorName = ex.getClass().getSimpleName();
        this.currentQueueSize = ex.getQueue().size();
        this.activeThreads = ex.getActiveCount();
        this.coreThreads = ex.getCorePoolSize();
        this.largestPoolSize = ex.getLargestPoolSize();
        this.maximumPoolSize = ex.getMaximumPoolSize();
    }

    this.leasesOwned = leaseCoordinator.getAssignments().size();
}
 
Example 3
Source File: CacheBaseInfo.java    From cache2k with Apache License 2.0 4 votes vote down vote up
public CacheBaseInfo(HeapCache _heapCache, InternalCache _userCache, long now) {
  infoCreatedTime = now;
  cache = _userCache;
  heapCache = _heapCache;
  metrics = _heapCache.metrics;
  EvictionMetrics em = _heapCache.eviction.getMetrics();
  newEntryCnt = em.getNewEntryCount();
  expiredRemoveCnt = em.getExpiredRemovedCount();
  evictedCnt = em.getEvictedCount();
  maxSize = em.getMaxSize();
  maxWeight = em.getMaxWeight();
  currentWeight = em.getCurrentWeight();
  clearedTime = _heapCache.clearedTime;
  keyMutationCnt = _heapCache.keyMutationCnt;
  removedCnt = em.getRemovedCount();
  clearRemovedCnt = _heapCache.clearRemovedCnt;
  clearCnt = _heapCache.clearCnt;
  internalExceptionCnt = _heapCache.internalExceptionCnt;
  evictionRunningCnt = em.getEvictionRunningCount();
  integrityState = _heapCache.getIntegrityState();
  collisionInfo = new CollisionInfo();
  _heapCache.hash.calcHashCollisionInfo(collisionInfo);
  extraStatistics = em.getExtraStatistics();
  if (extraStatistics.startsWith(", ")) {
    extraStatistics = extraStatistics.substring(2);
  }
  size = heapCache.getLocalSize();
  missCnt = metrics.getReadThroughCount() + metrics.getExplicitLoadCount() +
    metrics.getPeekHitNotFreshCount() + metrics.getPeekMissCount();
  hitCnt = em.getHitCount();
  correctedPutCnt = metrics.getPutNewEntryCount() + metrics.getPutHitCount();
  if (_heapCache.loaderExecutor instanceof ExclusiveExecutor) {
    ThreadPoolExecutor ex = ((ExclusiveExecutor) _heapCache.loaderExecutor).getThreadPoolExecutor();
    asyncLoadsInFlight = ex.getActiveCount();
    asyncLoadsStarted = ex.getTaskCount();
    loaderThreadsLimit = ex.getCorePoolSize();
    loaderThreadsMaxActive = ex.getLargestPoolSize();
  }
  totalLoadCnt = metrics.getReadThroughCount() + metrics.getExplicitLoadCount() +
    metrics.getRefreshCount();
}