You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2022/07/11 01:32:23 UTC

[GitHub] [servicecomb-java-chassis] yanghao605 commented on issue #3164: 升级到2.6.0版本发现filter逻辑是在网络线程,不是在业务线程,如果业务通过扩展filter获取业务线程上下文,当前2.6版本之后无法获取

yanghao605 commented on issue #3164:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3164#issuecomment-1179862571

   是在业务线程中设置ThreadLocal数据,在Filter中无法获取到数据。
     @RequestMapping(value = "/user", method = RequestMethod.GET)
       public String userInfo(@RequestParam(value = "name", required = true) String name) {
   
           ContextInterceptor.setContextCachethreadLocal(10000989);
   ……
   public class ContextInterceptor {
   
       private static final ThreadLocal<Integer> threadLocal = new ThreadLocal<>();
   
   ……
   public class CseTest implements HttpClientFilter {
   
       @Override
       public int getOrder() {
           return 0;
       }
   
       @Override
       public void beforeSendRequest(Invocation invocation, HttpServletRequestEx requestEx) {
   
           System.out.println("threadLocal=" + ContextInterceptor.getContextCachethreadLocal());
   这里获取为空


-- 
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: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org