Why OSClientSession is ThreadLocal? Because of that, we can not use the client in multiple threads easily. There is a guide about how to copy client in for multiple threads but this could raise multiple problems. for example, when must always get token from the main client and if that token has been expired(which is after 24 hours), we always need to reauthenticate at any request! because we create Client from expired token!
I believe that OSClientSession should not be thread local.
you can get OSClientSession from a util class,and the util class need to storage OSClientSession to a cache (for example com.google.common.cache.CacheBuilder)。
Why OSClientSession is ThreadLocal? Because of that, we can not use the client in multiple threads easily. There is a guide about how to copy client in for multiple threads but this could raise multiple problems. for example, when must always get token from the main client and if that token has been expired(which is after 24 hours), we always need to reauthenticate at any request! because we create Client from expired token! I believe that OSClientSession should not be thread local.