Croway commented on PR #26871:
URL: https://github.com/apache/camel/pull/26871#issuecomment-5829915920

   Thanks for the cleanup! Two call sites need a small follow-up, because 
restoring the flag there changes behaviour:
   
   **1. `TahuEdgeClient.shutdown()`**: `interrupt()` sits in the multi-catch 
`CancellationException | ExecutionException | InterruptedException`. The thread 
gets flagged as interrupted even when the client task just failed or was 
cancelled. This runs from `TahuEdgeProducer.doStop()`, so the Camel shutdown 
thread's next blocking call (stopping other services, `awaitTermination`, 
closing channels) can then fail. Split the catch:
   
   ```java
   } catch (InterruptedException e) {
       Thread.currentThread().interrupt();
       LOG.warn(loggingMarker, "Interrupted waiting for client shutdown", e);
   } catch (CancellationException | ExecutionException e) {
       LOG.warn(loggingMarker, "Caught exception waiting for client shutdown", 
e);
   }
   ```
   
   **2. `KubernetesPodLogs.sleepWell()`**: this is called inside the retry loop 
in `doCall()`, and nothing checks the flag. After one interrupt, every later 
`Thread.sleep(2000L)` throws immediately. The loop then runs through all 
remaining retries with no backoff, and `watchLogs()` runs on an interrupted 
thread each time. Have `sleepWell()` report the interrupt and stop retrying:
   
   ```java
   while ((retry || retryForReload) && ++retryCount < maxRetryAttempts) {
       if (!sleepWell()) {
           break;
       }
       ...
   }
   
   private boolean sleepWell() {
       try {
           Thread.sleep(2000L);
           return true;
       } catch (InterruptedException e) {
           Thread.currentThread().interrupt();
           printer().printf("Interrupted while waiting for pod - %s%n", 
e.getMessage());
           return false;
       }
   }
   ```
   
   _Claude Code on behalf of @Croway_
   


-- 
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