Skip to content

Commit 63e5d6e

Browse files
committed
Review comments
1 parent 9202637 commit 63e5d6e

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

modules/hivemq-edge-module-modbus/src/main/java/com/hivemq/edge/adapters/modbus/ModbusProtocolAdapter.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,15 @@ public ModbusProtocolAdapter(
7676

7777
@Override
7878
public void start(@NotNull final ProtocolAdapterStartInput input, @NotNull final ProtocolAdapterStartOutput output) {
79-
try {
80-
modbusClient
81-
.connect()
82-
.thenRun(() -> {
79+
modbusClient
80+
.connect()
81+
.whenComplete((unused, throwable) -> {
82+
if (throwable == null) {
8383
output.startedSuccessfully();
8484
protocolAdapterState.setConnectionStatus(CONNECTED);
85-
});
86-
} catch (final Exception e) {
87-
output.failStart(e, "Exception during setup of Modbus client.");
88-
}
89-
85+
} else {
86+
output.failStart(throwable, "Exception during setup of Modbus client.");
87+
}});
9088
}
9189

9290
@Override

0 commit comments

Comments
 (0)