に対応するObjectNameのJMXキーの値を取得します。

必要が特定の値のObjectNameに応じて判断される場合は、以前に、ローカルJMXの開発に使用した後に、ObjectNameがのtoString()の実装、および、文字列の傍受であり、今日ではObjectNameの方法があることを見出しました

/**
* Obtains the value associated with a key in a key property.
*
* @param property The property whose value is to be obtained.
*
* @return The value of the property, or null if there is no such
* property in this ObjectName.
*
* @exception NullPointerException If <code>property</code> is null.
*/
public String getKeyProperty(String property) throws NullPointerException {
return _getKeyPropertyList().get(property);
}

長い間、あなたが得ることができますが、全体の文字列を見てする必要はありません、対応するキー入力した値と同じ方法。
そのようなものとして

ObjectName oname = new ObjectName("com.abc:name=threadpool.thread-pool-1,type=thread-pool,category=monitor,server=server");
要获取name的值,只需要oname.getKeyProperty("name");即可把后面的一串拿到。

:ウィンク:
公開された56元の記事 ウォンの賞賛0 ビュー7777

おすすめ

転載: blog.csdn.net/chainhou/article/details/84457716