5.4.2. MBeanServer へ CacheJmxWrapper を登録
確実に
CacheJmxWrapper が JMX に登録されるようにする最良の方法は、 キャッシュをデプロイする方法によって異なります。
5.4.2.1. キャッシュインスタンスのプログラムによる登録 リンクのコピーリンクがクリップボードにコピーされました!
リンクのコピーリンクがクリップボードにコピーされました!
Cache を作成し、 JmxRegistrationManager コンストラクタへ渡す方法が最も簡単です。
CacheFactory factory = new DefaultCacheFactory();
// Build but don't start the cache
// (although it would work OK if we started it)
Cache cache = factory.createCache("cache-configuration.xml");
MBeanServer server = getMBeanServer(); // however you do it
ObjectName on = new ObjectName("jboss.cache:service=Cache");
JmxRegistrationManager jmxManager = new JmxRegistrationManager(server, cache, on);
jmxManager.registerAllMBeans();
... use the cache
... on application shutdown
jmxManager.unregisterAllMBeans();
cache.stop();