@Override public int getLargestWorkerCount() { return delegate.getLargestPoolSize(); } }
/** * Value from {@link ThreadPoolExecutor#getLargestPoolSize()} * * @return Number */ public Number getCurrentLargestPoolSize() { return threadPool.getLargestPoolSize(); }
@Override public int getPoolLargestPoolSize() { return pool.getLargestPoolSize(); }
/** {@inheritDoc} */ @Override public int getLargestPoolSize() { return exec instanceof ThreadPoolExecutor ? ((ThreadPoolExecutor)exec).getLargestPoolSize() : -1; }
public int getLargestThreadCount() { return super.getLargestPoolSize(); }
@Override public int getLargestPoolSize() { return executor.getLargestPoolSize(); }
@Override public int getLargestPoolSize() { return super.getLargestPoolSize() + 1; }
public int getLargestPoolSize() { return executor.getLargestPoolSize(); }
@ManagedAttribute(description="Largest number of threads in the internal thread pool") public int getInternalThreadPoolSizeLargest() { if(internal_pool instanceof ThreadPoolExecutor) return ((ThreadPoolExecutor)internal_pool).getLargestPoolSize(); return 0; }
@ManagedAttribute(description="Largest number of threads in the thread pool") public int getThreadPoolSizeLargest() { if(thread_pool instanceof ThreadPoolExecutor) return ((ThreadPoolExecutor)thread_pool).getLargestPoolSize(); return 0; }
@Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { if (LOGGER.isWarnEnabled()) { LOGGER.warn(LogCodes.getLog(LogCodes.ERROR_PROVIDER_TR_POOL_REJECTION, executor.getActiveCount(), executor.getPoolSize(), executor.getLargestPoolSize(), executor .getCorePoolSize(), executor.getMaximumPoolSize(), executor.getQueue() .size(), executor.getQueue().remainingCapacity())); } throw new RejectedExecutionException(); } }
@Override public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { String msg = String.format("Thread pool is EXHAUSTED!" + " Thread Name: %s, Pool Size: %d (active: %d, core: %d, max: %d, largest: %d), Task: %d (completed: %d)," + " Executor status:(isShutdown:%s, isTerminated:%s, isTerminating:%s), in %s://%s:%d!", threadName, e.getPoolSize(), e.getActiveCount(), e.getCorePoolSize(), e.getMaximumPoolSize(), e.getLargestPoolSize(), e.getTaskCount(), e.getCompletedTaskCount(), e.isShutdown(), e.isTerminated(), e.isTerminating(), url.getProtocol(), url.getIp(), url.getPort()); logger.warn(msg); dumpJStack(); throw new RejectedExecutionException(msg); }
+ ", max:" + tp.getMaximumPoolSize() + ", core:" + tp.getCorePoolSize() + ", largest:" + tp.getLargestPoolSize() + ", active:" + tp.getActiveCount() + ", task:" + tp.getTaskCount()
@Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { if (LOGGER.isWarnEnabled()) { LOGGER.warn(LogCodes.getLog(LogCodes.ERROR_PROVIDER_TR_POOL_REJECTION, executor.getActiveCount(), executor.getPoolSize(), executor.getLargestPoolSize(), executor .getCorePoolSize(), executor.getMaximumPoolSize(), executor.getQueue() .size(), executor.getQueue().remainingCapacity())); } throw new RejectedExecutionException(); } }
@Override public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { String msg = String.format("Thread pool is EXHAUSTED!" + " Thread Name: %s, Pool Size: %d (active: %d, core: %d, max: %d, largest: %d), Task: %d (completed: %d)," + " Executor status:(isShutdown:%s, isTerminated:%s, isTerminating:%s), in %s://%s:%d!", threadName, e.getPoolSize(), e.getActiveCount(), e.getCorePoolSize(), e.getMaximumPoolSize(), e.getLargestPoolSize(), e.getTaskCount(), e.getCompletedTaskCount(), e.isShutdown(), e.isTerminated(), e.isTerminating(), url.getProtocol(), url.getIp(), url.getPort()); logger.warn(msg); dumpJStack(); throw new RejectedExecutionException(msg); }
+ ", max:" + tp.getMaximumPoolSize() + ", core:" + tp.getCorePoolSize() + ", largest:" + tp.getLargestPoolSize() + ", active:" + tp.getActiveCount() + ", task:" + tp.getTaskCount()
@Override public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { String msg = String.format( "Thread pool is EXHAUSTED!" + " Thread Name: %s, Pool Size: %d (active: %d, core: %d, max: %d, largest: %d), Task: %d (completed: %d)," + " Executor status:(isShutdown:%s, isTerminated:%s, isTerminating:%s)!", threadName, e.getPoolSize(), e.getActiveCount(), e.getCorePoolSize(), e.getMaximumPoolSize(), e.getLargestPoolSize(), e.getTaskCount(), e.getCompletedTaskCount(), e.isShutdown(), e.isTerminated(), e.isTerminating()); logger.warn(msg); dummper.tryThreadDump(null); throw new RejectedExecutionException(msg); }
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { SocketServerSession session = (SocketServerSession) r; if(interrupted()) { logger.info("Denying connection from " + session.getSocket().getRemoteSocketAddress() + ", server is shutting down."); } else { logger.error("Too many open connections, " + executor.getActiveCount() + " of " + executor.getLargestPoolSize() + " threads in use, denying connection from " + session.getSocket().getRemoteSocketAddress()); } try { session.getSocket().close(); } catch(IOException e) { logger.error("Could not close socket.", e); } } };
@Override public synchronized void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { long completed = executor.getCompletedTaskCount(); if (completed < last_completed) { throw new IllegalStateException("Number of completed tasks shouldn't decrease"); } else if (completed == last_completed) { long now = System.currentTimeMillis(); if (now - last_change > period) { String message = String.format( "No progress for %d ms, possible distributed deadlock. Try raising threadpool size\n" + "\tMin size: %d\n\tMax size: %d\n\tCurrent size: %d\n\tActive: %d\n\tLargest size: %d\n" + "\tCompleted tasks: %d\n\tTotal scheduled: %d", now - last_change, executor.getCorePoolSize(), executor.getMaximumPoolSize(), executor.getPoolSize(), executor.getActiveCount(), executor.getLargestPoolSize(), executor.getCompletedTaskCount(), executor.getTaskCount()); throw new NoProgressException(message); } } else { last_change = System.currentTimeMillis(); last_completed = completed; } if (fallback != null) { fallback.rejectedExecution(r, executor); } } }
/** * This is for testing the active number of threads that were used while * doing a batch operation. It inserts one row per region via the batch * operation, and then checks the number of active threads. * <p/> * For HBASE-3553 */ @Test public void testActiveThreadsCount() throws Exception { UTIL.getConfiguration().setLong("hbase.htable.threads.coresize", slaves + 1); try (Connection connection = ConnectionFactory.createConnection(UTIL.getConfiguration())) { ThreadPoolExecutor executor = HTable.getDefaultExecutor(UTIL.getConfiguration()); try { try (Table t = connection.getTable(TEST_TABLE, executor)) { List<Put> puts = constructPutRequests(); // creates a Put for every region t.batch(puts, null); HashSet<ServerName> regionservers = new HashSet<>(); try (RegionLocator locator = connection.getRegionLocator(TEST_TABLE)) { for (Row r : puts) { HRegionLocation location = locator.getRegionLocation(r.getRow()); regionservers.add(location.getServerName()); } } assertEquals(regionservers.size(), executor.getLargestPoolSize()); } } finally { executor.shutdownNow(); } } }