openstack4j icon indicating copy to clipboard operation
openstack4j copied to clipboard

Why OSClientSession is ThreadLocal?

Open hossein-nasr opened this issue 6 years ago • 1 comments

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.

hossein-nasr avatar May 12 '19 11:05 hossein-nasr

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)。

marvel00000 avatar Jun 25 '19 01:06 marvel00000