The Value set in ThreadLocal for Spring JMX works inconsistently -


the value set in threadlocal spring jmx works inconsistently

@managedresource(objectname = "man-test:name=setvalue", description = "set value jmx") @component public class valuesetjmx {     private static threadlocal<string> jmxvalue = new threadlocal<string>();      @managedattribute     public void setmanvalue(string valuejmx) {     jmxvalue.set(valuejmx)     }      @managedattribute     public string getmanvalue() {             return jmxvalue.get();     } } 

after setting value setmanvalue , if invoke getmanvalue() multiple times, result null.

is there better way resolve this

i presume mean setting/getting value remotely.

no; can't use threadlocal - there no guarantee same rmi thread used each request.


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -