Java5 JMX
Java5でJMXに接続してメモリ消費量を調査する必要がでてきたので、JMXに関してのメモです。
※書く途中です。
import java.io.IOException; import sun.management.ConnectorAddressLink; public class JmxTest { public static void main(String[] args) { int pid = Integer.parseInt(args[0]); try { String address = ConnectorAddressLink.importFrom(pid); //接続つくってとか。。。 } catch (IOException e) { e.printStackTrace(); } } }
rt.jar、tools.jarをビルドパスに入れておきましょう。
Eclipseの設定で、
window->Preference->Compiler->Error/Warning->Deprecate and Restricted API->Forbidden Reference
をWarningに変更しておく。