jeremyxu2010 commented on issue #384: TransactionHandlerInterceptor pollute 
ThreadLocal variables
URL: 
https://github.com/apache/servicecomb-pack/issues/384#issuecomment-457909689
 
 
   @WillemJiang In our project, when controller method throws exception, 
ThreadLocal variables still be polluted. so fixed code should be:
   
   ```java
   class TransactionHandlerInterceptor implements HandlerInterceptor {
     ......
     @Override
     public void postHandle(HttpServletRequest request, HttpServletResponse 
response, Object o, ModelAndView mv) {
     }
   
     @Override
     public void afterCompletion(HttpServletRequest request, 
HttpServletResponse response, Object o, Exception e) {
       if (omegaContext != null) {
         omegaContext.clear();
       }
     }
   }
   ```
   
   I will send a PR again.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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