[Minor] code cleanup
This commit is contained in:
parent
517095434c
commit
5461cad1d9
|
@ -229,7 +229,7 @@ public class DefaultPlcHandler extends StrolchComponent implements PlcHandler, P
|
||||||
|
|
||||||
plc = PlcConfigurator.configurePlc(tx, plcClassName, plcAddresses, plcTelegrams, addressesToResourceId);
|
plc = PlcConfigurator.configurePlc(tx, plcClassName, plcAddresses, plcTelegrams, addressesToResourceId);
|
||||||
plc.setConnectionStateChangeListener(this);
|
plc.setConnectionStateChangeListener(this);
|
||||||
plcAddresses.values().forEach(plcAddress -> plc.register(plcAddress, this::asyncUpdateState));
|
plcAddresses.values().forEach(plcAddress -> plc.register(plcAddress, this::updateState));
|
||||||
|
|
||||||
if (tx.needsCommit())
|
if (tx.needsCommit())
|
||||||
tx.commitOnClose();
|
tx.commitOnClose();
|
||||||
|
@ -238,7 +238,7 @@ public class DefaultPlcHandler extends StrolchComponent implements PlcHandler, P
|
||||||
return plc;
|
return plc;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void asyncUpdateState(PlcAddress address, Object value) {
|
private void updateState(PlcAddress address, Object value) {
|
||||||
if (this.asyncAddressUpdate)
|
if (this.asyncAddressUpdate)
|
||||||
getExecutorService("PlcAddressUpdater").submit(() -> updatePlcAddress(address, value));
|
getExecutorService("PlcAddressUpdater").submit(() -> updatePlcAddress(address, value));
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue