[openwebnet] Replace scheduleAtFixedRate by scheduleWithFixedDelay (#10822)

- fixed some other spotless issues

Signed-off-by: Conte Andrea <andrea@conte.com>
This commit is contained in:
Conte Andrea 2021-06-12 12:32:00 +02:00 committed by GitHub
parent e452de8e15
commit fc66615fce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -56,8 +56,8 @@ public class OpenWebNetEnergyHandler extends OpenWebNetThingHandler {
private final Logger logger = LoggerFactory.getLogger(OpenWebNetEnergyHandler.class); private final Logger logger = LoggerFactory.getLogger(OpenWebNetEnergyHandler.class);
public final static Set<ThingTypeUID> SUPPORTED_THING_TYPES = OpenWebNetBindingConstants.ENERGY_MANAGEMENT_SUPPORTED_THING_TYPES; public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = OpenWebNetBindingConstants.ENERGY_MANAGEMENT_SUPPORTED_THING_TYPES;
public final int ENERGY_SUBSCRIPTION_PERIOD = 10; // minutes public static final int ENERGY_SUBSCRIPTION_PERIOD = 10; // minutes
private @Nullable ScheduledFuture<?> notificationSchedule; private @Nullable ScheduledFuture<?> notificationSchedule;
public OpenWebNetEnergyHandler(Thing thing) { public OpenWebNetEnergyHandler(Thing thing) {
@ -98,7 +98,7 @@ public class OpenWebNetEnergyHandler extends OpenWebNetThingHandler {
} }
private void subscribeToActivePowerChanges() { private void subscribeToActivePowerChanges() {
notificationSchedule = scheduler.scheduleAtFixedRate(() -> { notificationSchedule = scheduler.scheduleWithFixedDelay(() -> {
if (isFirstSchedulerLaunch) { if (isFirstSchedulerLaunch) {
logger.debug( logger.debug(
"subscribeToActivePowerChanges() For WHERE={} subscribing to active power changes notification for the next {}min", "subscribeToActivePowerChanges() For WHERE={} subscribing to active power changes notification for the next {}min",
@ -182,11 +182,12 @@ public class OpenWebNetEnergyHandler extends OpenWebNetThingHandler {
return; return;
} else { } else {
// fix: check for correct DIM (ActivePower / 113) // fix: check for correct DIM (ActivePower / 113)
if (msg.getDim().equals(DIM.ACTIVE_POWER)) if (msg.getDim().equals(DIM.ACTIVE_POWER)) {
updateActivePower(msg); updateActivePower(msg);
else } else {
logger.debug("handleMessage() Ignoring message {} because it's not related to active power value.", logger.debug("handleMessage() Ignoring message {} because it's not related to active power value.",
msg); msg);
}
} }
} }

View File

@ -53,7 +53,7 @@ public class OpenWebNetThermoregulationHandler extends OpenWebNetThingHandler {
private final Logger logger = LoggerFactory.getLogger(OpenWebNetThermoregulationHandler.class); private final Logger logger = LoggerFactory.getLogger(OpenWebNetThermoregulationHandler.class);
public final static Set<ThingTypeUID> SUPPORTED_THING_TYPES = OpenWebNetBindingConstants.THERMOREGULATION_SUPPORTED_THING_TYPES; public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = OpenWebNetBindingConstants.THERMOREGULATION_SUPPORTED_THING_TYPES;
private boolean isTempSensor = false; // is the device a sensor or thermostat? private boolean isTempSensor = false; // is the device a sensor or thermostat?