surroundings
Tomcat8
Scene Description
Via the interceptor intercepts the request, the user login information into ThreadLocal prior to the request. There is a list of businesses acquired user management interfaces in the build is not very suitable in commodity class. When developing the business version will be moved to the user class, in order to facilitate the testing to exclude it from the interceptor out. This leads to the probability can not get business information.
the reason
Mainly due to acquisition in acquiring the business from ThreadLocal interface in the user login information, did not get to return failed.
In the interceptor did not return ThreadLocal. Tomcat thread of execution led to retain user information, the next time the call / venders request, if the work assigned to this thread, the user can obtain the information. If assigned to another worker thread, the user can not get the information. So to recover ThreadLocal at the interceptor.
Tomcat is because the thread pool mode! There is not a minimum number of threads have been shut down service!
Reproduced in: https: //www.jianshu.com/p/b0725d856c06