chanjarster commented on a change in pull request #599: SCB-1604 modify 
InterruptedException
URL: https://github.com/apache/servicecomb-pack/pull/599#discussion_r349398317
 
 

 ##########
 File path: 
omega/omega-transaction/src/main/java/org/apache/servicecomb/pack/omega/transaction/ForwardRecovery.java
 ##########
 @@ -66,6 +66,7 @@ public Object applyTo(ProceedingJoinPoint joinPoint, 
Compensable compensable, Co
         }
       }
     } catch (InterruptedException e) {
+      Thread.currentThread().interrupt();
 
 Review comment:
   @coolbeevip I read the code and found that the InterruptedException is 
thrown by the sleep on line 65 (which is not shown here).
   The most likely reason why sleep is interrupted is some one shutdown the 
application. So I think it's safe to log it and rethrow it.
   The previous code version just swallow the InterruptedException that prevent 
the application shutdown, that's not good, that's why we need to recover the 
interrupt state or rethrow InterruptedException.
   Here is the node when I study interruption, hope it will be helpful: 
https://chanjarster.github.io/post/concurrent-programming/cancellation-and-shutdown/

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to