Skip to content

Commit

Permalink
fix(plc4j/drivers/s7): fix Camel is immediately trying to reconnect b…
Browse files Browse the repository at this point in the history
…ecause the IS_CONNECTED attribute is set 1ms from a child thread (after the S7HPlcConnection assumes the connection is fully established) (#1879)

Co-authored-by: Jochen Meierhofer <[email protected]>
  • Loading branch information
jmeierhofer and Jochen Meierhofer authored Nov 11, 2024
1 parent 609b930 commit 0ad7a7b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exceptio
*/
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
super.userEventTriggered(ctx, evt);
logger.info(LocalTime.now() + " userEventTriggered: " + ctx.name() + " Event: " + evt);

if (evt instanceof ConnectedEvent) {
Expand Down Expand Up @@ -204,6 +203,9 @@ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exc
if (evt instanceof DisconnectEvent) {
logger.info("DisconnectEvent");
}

// trigger other event handlers after IS_CONNECTED was set
super.userEventTriggered(ctx, evt);
}

@Override
Expand Down

0 comments on commit 0ad7a7b

Please sign in to comment.