dev@glassfish.java.net

Re: I can not get monitoring MBeans using AMX in glassfish v2

From: llc <lloyd.chambers_at_Sun.COM>
Date: Mon, 15 Dec 2008 09:24:35 -0800 (PST)

sarah.kho wrote:
>
> Hi
> Thank you for reading my post.
> i am trying to get monitoring information for one of my thread pools in
> the glassfish v2.
> i can see the monitoring information in the jconsole but when i try to get
> the same information in java code, it looks like that glassfish does not
> return the information
> here is my code
>
> Set<AMX> st = domainroot.getContaineeSet(XTypes.THREAD_POOL_MONITOR);
>
> the set is always empty without any item inside it. is there any trick in
> it?
>

You are trying to get child MBeans of DomainRoot which don't exist; it is
not a flat namespace, it is a hierarchy, and DomainRoot is the top level of
the AMX hierarchy.

Please see the javadoc:
https://glassfish.dev.java.net/nonav/javaee5/amx/javadoc/index.html


Map<String,ThreadPoolMonitor> tpms =
 
domainRoot.getMonitoringRoot().getServerRootMonitorMap().get(serverName).getThreadPoolMonitorMap();

for( ThreadPoolMonitor m : tpms ) {
...
}

You can also query for all ThreadPoolMonitor in all servers using:

Set<ThreadPoolMonitor> tpms =
   domainRoot.getQueryMgr().queryJ2EETypeSet(XTypes.THREAD_POOL_MONITOR);
for( ThreadPoolMonitor m : tpms ) {
...
}
-- 
View this message in context: http://www.nabble.com/I-can-not-get-monitoring-MBeans-using-AMX-in-glassfish-v2-tp20999929p21017967.html
Sent from the java.net - glassfish dev mailing list archive at Nabble.com.