What is the different between:
What are the pros and cons of each and when should we choose either of these two components to manage a resource?
A standard mbean has fixed meta-data which does not change during the lifetime of the MBean. Dynamic MBeans define their meta-data on the fly and can modify and re-publish their meta-data. Think about this [badly] contrived analogy to Java: Let's say you wrote a class that listed the number of files in a directory. A standard class method might look like:
public int getFileCount(String directoryName)
On the other hand, the Dynamic MBean version of this class would start with no methods, but when it starts up, it scans the directories available, and creates a new method for each directory found:
public int getFileCountDir1();
public int getFileCountDir2();
....
public int getFileCountDirN();
So that's not a very useful setup, but suppose you wanted to create an MBean that displayed all the JVM's System Properties. Well.... System Properties change... and there's no reasonable way of knowing which property keys will be defined ahead of time, so that would be a better representation of what a Dynamic MBean is good for.
The pros and the cons really come down to:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With