本文整理了Java中java.util.concurrent.ScheduledThreadPoolExecutor.getCompletedTaskCount()
方法的一些代码示例,展示了ScheduledThreadPoolExecutor.getCompletedTaskCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScheduledThreadPoolExecutor.getCompletedTaskCount()
方法的具体详情如下:
包路径:java.util.concurrent.ScheduledThreadPoolExecutor
类名称:ScheduledThreadPoolExecutor
方法名:getCompletedTaskCount
暂无
代码示例来源:origin: i2p/i2p.i2p
/** warning - slow */
private long getCompletedTaskCount() {
return _executor.getCompletedTaskCount();
}
代码示例来源:origin: gravitee-io/gravitee-gateway
public long getCompletedTaskCount() {
return SubscriptionsServiceHandler.this.executorService.getCompletedTaskCount();
}
}
代码示例来源:origin: gravitee-io/gravitee-gateway
public long getCompletedTaskCount() {
return ApiKeysServiceHandler.this.executorService.getCompletedTaskCount();
}
}
代码示例来源: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: io.gravitee.gateway.services/gravitee-gateway-services-subscriptions-cache
public long getCompletedTaskCount() {
return SubscriptionsServiceHandler.this.executorService.getCompletedTaskCount();
}
}
代码示例来源:origin: i2p/i2p.i2p
public void run() {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Running: " + _timedEvent);
long before = System.currentTimeMillis();
if (_log.shouldLog(Log.WARN) && before < _scheduled - 100)
_log.warn(_name + " early execution " + (_scheduled - before) + ": " + _timedEvent);
else if (_log.shouldLog(Log.WARN) && before > _scheduled + 1000)
_log.warn("late execution " + (before - _scheduled) + ": " + _timedEvent + debug());
try {
_timedEvent.timeReached();
} catch (Throwable t) {
_log.log(Log.CRIT, _name + ": Scheduled task " + _timedEvent + " exited unexpectedly, please report", t);
}
long time = System.currentTimeMillis() - before;
if (time > 1000 && _log.shouldLog(Log.WARN))
_log.warn(_name + " event execution took " + time + ": " + _timedEvent);
if (_log.shouldLog(Log.INFO)) {
// this call is slow - iterates through a HashMap -
// would be better to have a local AtomicLong if we care
long completed = _executor.getCompletedTaskCount();
if (completed % 250 == 0)
_log.info(debug());
}
}
}
代码示例来源:origin: io.gravitee.gateway.services/gravitee-gateway-services-apikeyscache
public long getCompletedTaskCount() {
return ApiKeysServiceHandler.this.executorService.getCompletedTaskCount();
}
}
代码示例来源:origin: wildfly/wildfly-core
public long getCompletedTaskCount() {
return executor.getCompletedTaskCount();
}
代码示例来源: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: org.jvnet.hudson/htmlunit
/**
* Returns the approximate number of jobs currently executing and waiting to be executed. This
* method can only guarantee approximate results, because these are the only guarantees provided
* by the {@link ScheduledThreadPoolExecutor} API which this method is built on.
* @return the approximate number of jobs currently executing and waiting to be executed
*/
private synchronized int getJobCountInner() {
executor_.purge();
return (int) (executor_.getTaskCount() - executor_.getCompletedTaskCount());
}
代码示例来源:origin: org.jenkins-ci/htmlunit
/**
* Returns the approximate number of jobs currently executing and waiting to be executed. This
* method can only guarantee approximate results, because these are the only guarantees provided
* by the {@link ScheduledThreadPoolExecutor} API which this method is built on.
* @return the approximate number of jobs currently executing and waiting to be executed
*/
private synchronized int getJobCountInner() {
executor_.purge();
return (int) (executor_.getTaskCount() - executor_.getCompletedTaskCount());
}
代码示例来源:origin: net.disy.htmlunit/htmlunit
/**
* Returns the approximate number of jobs currently executing and waiting to be executed. This
* method can only guarantee approximate results, because these are the only guarantees provided
* by the {@link ScheduledThreadPoolExecutor} API which this method is built on.
* @return the approximate number of jobs currently executing and waiting to be executed
*/
private synchronized int getJobCountInner() {
executor_.purge();
return (int) (executor_.getTaskCount() - executor_.getCompletedTaskCount());
}
代码示例来源:origin: inspectIT/inspectIT
/**
* Updates the write status.
*/
private void checkWritingStatus() {
if (null != writingExecutorService) {
long completedTasks = writingExecutorService.getCompletedTaskCount();
long queuedTasks = writingExecutorService.getTaskCount() - completedTasks;
long arrivedTasksForPeriod = (queuedTasks + completedTasks) - totalTasks;
long finishedTasksForPeriod = completedTasks - finishedTasks;
writingStatus = WritingStatus.getWritingStatus(arrivedTasksForPeriod, finishedTasksForPeriod);
finishedTasks = completedTasks;
totalTasks = completedTasks + queuedTasks;
} else {
writingStatus = WritingStatus.GOOD;
}
}
代码示例来源:origin: hibernate/hibernate-search
private void assertTaskExecuted(ScheduledThreadPoolExecutor executor, int taskCount) {
Assert.assertTrue( executor.getCompletedTaskCount() >= taskCount );
}
代码示例来源:origin: OpenNMS/opennms
private synchronized void scheduleReads(final ScheduledThreadPoolExecutor executor) {
LOG.debug("scheduleReads: acquired lock, creating schedule...");
executor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
m_future = executor.scheduleWithFixedDelay(this.getAckProcessor(), getSchedule().getInitialDelay(),
getSchedule().getInterval(), getSchedule().getUnit());
LOG.debug("scheduleReads: exited lock, schedule updated.");
LOG.debug("scheduleReads: schedule is: attempts remaining: {}; initial delay: {}; interval: {}; unit: {}",
getSchedule().getAttemptsRemaining(),
getSchedule().getInitialDelay(),
getSchedule().getInterval(),
getSchedule().getUnit());
LOG.debug("scheduleReads: executor details: active count: {}; completed task count: {}; task count: {}; queue size: {}", executor.getActiveCount(), executor.getCompletedTaskCount(), executor.getTaskCount(), executor.getQueue().size());
}
内容来源于网络,如有侵权,请联系作者删除!