gnodet-bot commented on code in PR #27613:
URL: https://github.com/apache/camel/pull/27613#discussion_r4247417673


##########
components/camel-jgroups-raft/src/main/java/org/apache/camel/component/jgroups/raft/cluster/JGroupsRaftClusterView.java:
##########
@@ -108,8 +113,10 @@ protected void doStart() throws Exception {
     protected void doStop() throws Exception {

Review Comment:
   🐛 **Listener leak on stop→start cycles:** `removeRoleListener` is only 
called in `doShutdown()`, but Camel's `BaseService.stop()` calls `doStop()` — 
`doShutdown()` is only invoked on full shutdown. `AbstractCamelClusterService` 
calls `view.stop()` / `view.start()` for stop→start cycles; `doStart()` 
unconditionally calls `raftHandle.addRoleListener(roleListener)`, so each cycle 
adds a fresh listener without removing the previous one.
   
   Move `removeRoleListener` to `doStop()` (or call it in both):
   
   ```suggestion
           if (raftHandle != null && roleListener != null) {
               raftHandle.removeRoleListener(roleListener);
               roleListener = null;
           }
           if (raftHandle != null && raftHandle.channel() != null) {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to