private StatisticsWorkMode workMode = StatisticsWorkMode.COLLECTALL;
private final Semaphore workModeGuard = new Semaphore(1, true);
- private boolean isStatisticsPollingEnabled;
+ private boolean isStatisticsPollingOff;
private BindingAwareBroker.RpcRegistration<StatisticsManagerControlService> controlServiceRegistration;
private final HashedWheelTimer hashedWheelTimer;
}
public StatisticsManagerImpl(final RpcProviderRegistry rpcProviderRegistry,
- final boolean isStatisticsPollingEnabled,
+ final boolean isStatisticsPollingOff,
final HashedWheelTimer hashedWheelTimer,
final ConvertorExecutor convertorExecutor) {
Preconditions.checkArgument(rpcProviderRegistry != null);
this.controlServiceRegistration = Preconditions.checkNotNull(
rpcProviderRegistry.addRpcImplementation(StatisticsManagerControlService.class, this)
);
- this.isStatisticsPollingEnabled = isStatisticsPollingEnabled;
+ this.isStatisticsPollingOff = isStatisticsPollingOff;
this.hashedWheelTimer = hashedWheelTimer;
}
final StatisticsContext statisticsContext =
new StatisticsContextImpl(
deviceInfo,
- isStatisticsPollingEnabled,
+ isStatisticsPollingOff,
lifecycleService,
converterExecutor,
this);
@Override
public void onFailure(@Nonnull final Throwable throwable) {
timeCounter.addTimeMark();
- LOG.warn("Statistics gathering for single node {} was not successful: ", deviceInfo.getLOGValue(), throwable.getMessage());
+ LOG.warn("Statistics gathering for single node {} was not successful: {}", deviceInfo.getLOGValue(),
+ throwable.getMessage());
if (LOG.isTraceEnabled()) {
LOG.trace("Gathering for node {} failure: ", deviceInfo.getLOGValue(), throwable);
}
});
final long averageTime = TimeUnit.MILLISECONDS.toSeconds(timeCounter.getAverageTimeBetweenMarks());
- final long STATS_TIMEOUT_SEC = averageTime > 0 ? 3 * averageTime : DEFAULT_STATS_TIMEOUT_SEC;
+ final long statsTimeoutSec = averageTime > 0 ? 3 * averageTime : DEFAULT_STATS_TIMEOUT_SEC;
final TimerTask timerTask = timeout -> {
if (!deviceStatisticsCollectionFuture.isDone()) {
- LOG.info("Statistics collection for node {} still in progress even after {} secs", deviceInfo.getLOGValue(), STATS_TIMEOUT_SEC);
+ LOG.info("Statistics collection for node {} still in progress even after {} secs", deviceInfo.getLOGValue(), statsTimeoutSec);
deviceStatisticsCollectionFuture.cancel(true);
}
};
- hashedWheelTimer.newTimeout(timerTask, STATS_TIMEOUT_SEC, TimeUnit.SECONDS);
+ hashedWheelTimer.newTimeout(timerTask, statsTimeoutSec, TimeUnit.SECONDS);
}
private void scheduleNextPolling(final DeviceState deviceState,
if (LOG.isDebugEnabled()) {
LOG.debug("SCHEDULING NEXT STATISTICS POLLING for device: {}", deviceInfo.getNodeId());
}
- if (!isStatisticsPollingEnabled) {
+ if (!isStatisticsPollingOff) {
final Timeout pollTimeout = hashedWheelTimer.newTimeout(
timeout -> pollStatistics(
deviceState,
if (workModeGuard.tryAcquire()) {
final StatisticsWorkMode targetWorkMode = input.getMode();
if (!workMode.equals(targetWorkMode)) {
- isStatisticsPollingEnabled = StatisticsWorkMode.FULLYDISABLED.equals(targetWorkMode);
+ isStatisticsPollingOff = StatisticsWorkMode.FULLYDISABLED.equals(targetWorkMode);
// iterate through stats-ctx: propagate mode
for (Map.Entry<DeviceInfo, StatisticsContext> entry : contexts.entrySet()) {
final DeviceInfo deviceInfo = entry.getKey();
@Override
public void startScheduling(final DeviceInfo deviceInfo) {
- if (isStatisticsPollingEnabled) {
+ if (isStatisticsPollingOff) {
LOG.info("Statistics are shutdown for device: {}", deviceInfo.getNodeId());
return;
}
this.deviceTerminPhaseHandler = handler;
}
+ @Override
+ public void setIsStatisticsPollingOff(boolean isStatisticsPollingOff){
+ this.isStatisticsPollingOff = isStatisticsPollingOff;
+ }
+
}