Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jmx mbean thread safety

Tags:

java

jmx

if i have a class, that is also a mbean, and i use functions of the class in my code, in only one thread, and also call a function by jmx, should i synchronize that code? thanks

like image 442
joe Avatar asked Feb 15 '10 09:02

joe


1 Answers

The code should be thread-safe, yes. If you choose to make it thread-safe using synchronized, then that's up to you.

MBeans that are invoked via JMX will be invoked by the container, using its own threads, separate from your own code's threads.

like image 105
skaffman Avatar answered Nov 01 '22 05:11

skaffman