private StatisticsWorkMode workMode = StatisticsWorkMode.COLLECTALL;
private final Semaphore workModeGuard = new Semaphore(1, true);
- private boolean isStatisticsPollingOff;
+ private boolean isStatisticsPollingOn;
private BindingAwareBroker.RpcRegistration<StatisticsManagerControlService> controlServiceRegistration;
private final HashedWheelTimer hashedWheelTimer;
}
public StatisticsManagerImpl(final RpcProviderRegistry rpcProviderRegistry,
- final boolean isStatisticsPollingOff,
+ final boolean isStatisticsPollingOn,
final HashedWheelTimer hashedWheelTimer,
final ConvertorExecutor convertorExecutor) {
Preconditions.checkArgument(rpcProviderRegistry != null);
this.controlServiceRegistration = Preconditions.checkNotNull(
rpcProviderRegistry.addRpcImplementation(StatisticsManagerControlService.class, this)
);
- this.isStatisticsPollingOff = isStatisticsPollingOff;
+ this.isStatisticsPollingOn = isStatisticsPollingOn;
this.hashedWheelTimer = hashedWheelTimer;
}
final StatisticsContext statisticsContext =
new StatisticsContextImpl(
deviceInfo,
- isStatisticsPollingOff,
+ isStatisticsPollingOn,
lifecycleService,
converterExecutor,
this);
if (LOG.isDebugEnabled()) {
LOG.debug("SCHEDULING NEXT STATISTICS POLLING for device: {}", deviceInfo.getNodeId());
}
- if (!isStatisticsPollingOff) {
+ if (isStatisticsPollingOn) {
final Timeout pollTimeout = hashedWheelTimer.newTimeout(
timeout -> pollStatistics(
deviceState,
if (workModeGuard.tryAcquire()) {
final StatisticsWorkMode targetWorkMode = input.getMode();
if (!workMode.equals(targetWorkMode)) {
- isStatisticsPollingOff = StatisticsWorkMode.FULLYDISABLED.equals(targetWorkMode);
+ isStatisticsPollingOn = !(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 (isStatisticsPollingOff) {
+ if (!isStatisticsPollingOn) {
LOG.info("Statistics are shutdown for device: {}", deviceInfo.getNodeId());
return;
}
this.deviceTerminationPhaseHandler = handler;
}
- @Override
- public void setIsStatisticsPollingOff(boolean isStatisticsPollingOff){
- this.isStatisticsPollingOff = isStatisticsPollingOff;
+ @Override
+ public void setIsStatisticsPollingOn(boolean isStatisticsPollingOn){
+ this.isStatisticsPollingOn = isStatisticsPollingOn;
}
public void onDeviceRemoved(DeviceInfo deviceInfo) {