/** * Value from {@link ThreadPoolExecutor#getCompletedTaskCount()} * * @return Number */ public Number getCurrentCompletedTaskCount() { return threadPool.getCompletedTaskCount(); }
@Override public long getPoolCompletedTaskCount() { return pool.getCompletedTaskCount(); }
/** {@inheritDoc} */ @Override public long getCompletedTaskCount() { return exec instanceof ThreadPoolExecutor ? ((ThreadPoolExecutor)exec).getCompletedTaskCount() : -1; }
@Override public long getCompletedTaskCount() { return executor.getCompletedTaskCount(); }
public long getCompletedTaskCount() { return executor.getCompletedTaskCount(); } }
public Long value() { return executor.getCompletedTaskCount(); } });
public int getProgress() { return (int) (executor.getCompletedTaskCount() * 100 / (double) executor.getTaskCount()); } }
/** * Return status information about the underlying threadpool. */ @Override public String toString() { return String.format("active: %d/%d submitted: %d completed: %d input_q: %d output_q: %d idle_q: %d", threadPool.getActiveCount(), threadPool.getPoolSize(), threadPool.getTaskCount(), threadPool.getCompletedTaskCount(), threadPool.getQueue().size(), outputQueue.size(), idleProcessors.size()); }
BlockingIOStat(BlockingIOProcessor blockingIOProcessor, ReportScheduler reportScheduler) { this(blockingIOProcessor.messagingExecutor.getQueue().size(), blockingIOProcessor.messagingExecutor.getCompletedTaskCount(), blockingIOProcessor.historyExecutor.getQueue().size(), blockingIOProcessor.historyExecutor.getCompletedTaskCount(), blockingIOProcessor.dbExecutor.getQueue().size(), blockingIOProcessor.dbExecutor.getCompletedTaskCount(), blockingIOProcessor.dbGetServerExecutor.getQueue().size(), blockingIOProcessor.dbGetServerExecutor.getCompletedTaskCount(), reportScheduler.getQueue().size(), reportScheduler.getCompletedTaskCount(), reportScheduler.map.size() ); }
@com.netflix.servo.annotations.Monitor(name = "completedTaskCount", type = COUNTER) long getCompletedTaskCount() { return pool.getCompletedTaskCount(); }
public Long value() { return executor.getTaskCount() - executor.getCompletedTaskCount(); } });
@ManagedAttribute public long getThreadPoolCompletedTasks() {return thread_pool.getCompletedTaskCount();}
@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); }
@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); }
@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); }
@Override public void run() { try { decompiler.getArgs().setRootDir(dir); ThreadPoolExecutor ex = (ThreadPoolExecutor) decompiler.getSaveExecutor(); ex.shutdown(); while (ex.isTerminating()) { long total = ex.getTaskCount(); long done = ex.getCompletedTaskCount(); progressMonitor.setProgress((int) (done * 100.0 / (double) total)); Thread.sleep(500); } progressMonitor.close(); LOG.info("decompilation complete, freeing memory ..."); decompiler.getClasses().forEach(JavaClass::unload); LOG.info("done"); } catch (InterruptedException e) { LOG.error("Save interrupted", e); Thread.currentThread().interrupt(); } } };
@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); } } }
private void addAbsent(AlluxioURI path) throws Exception { final ThreadPoolExecutor pool = Whitebox.getInternalState(mUfsAbsentPathCache, "mPool"); final long initialTasks = pool.getCompletedTaskCount(); mUfsAbsentPathCache.process(path, Collections.emptyList()); // Wait until the async task is completed. CommonUtils.waitFor("path (" + path + ") to be added to absent cache", () -> pool.getCompletedTaskCount() != initialTasks, WaitForOptions.defaults().setTimeoutMs(10000)); }
private void removeAbsent(AlluxioURI path) throws Exception { final ThreadPoolExecutor pool = Whitebox.getInternalState(mUfsAbsentPathCache, "mPool"); final long initialTasks = pool.getCompletedTaskCount(); mUfsAbsentPathCache.process(path, Collections.emptyList()); // Wait until the async task is completed. CommonUtils.waitFor("path (" + path + ") to be removed from absent cache", () -> pool.getCompletedTaskCount() != initialTasks, WaitForOptions.defaults().setTimeoutMs(10000)); }
@Test public void testPriorityRegionIsOpenedWithSeparateThreadPool() throws Exception { final TableName tableName = TableName.valueOf(TestRegionOpen.class.getSimpleName()); ThreadPoolExecutor exec = getRS().getExecutorService() .getExecutorThreadPool(ExecutorType.RS_OPEN_PRIORITY_REGION); long completed = exec.getCompletedTaskCount(); HTableDescriptor htd = new HTableDescriptor(tableName); htd.setPriority(HConstants.HIGH_QOS); htd.addFamily(new HColumnDescriptor(HConstants.CATALOG_FAMILY)); try (Connection connection = ConnectionFactory.createConnection(HTU.getConfiguration()); Admin admin = connection.getAdmin()) { admin.createTable(htd); } assertEquals(completed + 1, exec.getCompletedTaskCount()); }