inponomarev opened a new pull request, #1590:
URL: https://github.com/apache/commons-lang/pull/1590

   ## Problem
   
   `UncheckedFutureImpl.get()` and `get(long, TimeUnit)` catch 
`InterruptedException` and rethrow it as `UncheckedInterruptedException`, but 
do not restore the thread’s interrupt status.
   
   Catching `InterruptedException` clears the interrupt flag. As a result, 
callers relying on `Thread.currentThread().isInterrupted()` could incorrectly 
observe a non-interrupted state after calling `UncheckedFuture.get()`, breaking 
standard cooperative cancellation patterns.
   
   This issue is tracked as 
[LANG-1817](https://issues.apache.org/jira/browse/LANG-1817)
   .
   ## Changes
   
   Changes
   
   Restore the interrupt status before rethrowing UncheckedInterruptedException:
   
   ```java
   catch (InterruptedException e) {
       Thread.currentThread().interrupt();
       throw new UncheckedInterruptedException(e);
   }
   ```
   
   This is applied to both `get()` overloads.
   
   Added regression tests that:
   
   * execute `UncheckedFuture.get()` and `get(timeout, unit)` on a worker 
thread,
   * interrupt that thread via `ExecutorService.shutdownNow()`,
   * assert that the interrupt flag remains set after the unchecked exception 
is thrown.


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