RLDE26 commented on PR #11606:
URL: https://github.com/apache/rocketmq/pull/11606#issuecomment-7184431169

   @ShannonDing Thanks for the detailed review and for reproducing the ordering 
— you were right. I have addressed all three required changes in `c978cac`.
   
   1. The interruption is now recorded and cleared on entry (`boolean 
interrupted = Thread.interrupted()`) and restored in the outermost `finally`, 
not inside the catch block. Clearing on entry matters for both triggers you 
described: when the caller is already interrupted and the compaction pool is 
idle, `awaitTermination()` returns `true` without checking the flag, so 
deferring the restore alone would still leave it set when `preShutdown()` runs.
   2. With the flag clear during cleanup, the `join()` in 
`ServiceThread#shutdown()` really waits, so `db.closeE()` is reached only after 
the flush thread has exited.
   3. `ConfigStorageShutdownInterruptTest` now covers two cases: interrupted 
before `shutdown()` with an idle compaction pool, and interrupted while blocked 
in `awaitTermination()`. Both keep a real `ServiceThread` alive for 500 ms, so 
a premature join is guaranteed to observe it still running. They assert the 
worker has exited before the DB handle is released and that the caller's 
interrupt status is restored on return. Reverting the entry line to `boolean 
interrupted = false` makes the first case fail with `flush worker must have 
exited before the DB handle is released`.
   
   The other changes (streams, iterator, Zstd) are untouched. The branch is 
updated, so CI will run on the latest commit. Could you take another look?
   


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