You should send this topic to serviceability-dev which is the mailing list for 
JMX and other serviceability related issues.

Mandy

> On Feb 23, 2017, at 4:17 PM, Dave Brosius <dbros...@mebigfatguy.com> wrote:
> 
> Greetings. the method
> 
> public static ObjectName getInstance(String domain,
> Hashtable<String,String> table)
>        throws MalformedObjectNameException {
>        return new ObjectName(domain, table);
>    }
> 
> in javax.management.ObjectName allows for a provided Hashtable to specify 
> properties for the objectname.
> 
> The semantics of an ObjectName don't consider the order of these properties, 
> however certain tools like jconsole (when used as a name for a jmx property) 
> does consider the order.
> 
> If you wish to create a folder structure to report metrics in jmx, you need 
> to use this properties map to specify the folder names. JConsole, then, uses 
> order of iteration to determine the order of the folder hierarchy.
> 
> Suppose you want a folder hierarchy similar to a package name, you may 
> specify properties like
> 
> table.put("a0", "com");
> table.put("a1", "acme");
> table.put("name", "MyMetric");
> 
> in hopes of producing a metric in JConsole in the folder structure, 
> com/acme/MyMetric.
> 
> The problem is of course, that the argument is a Hashtable, not a Map, and so 
> the items are not ordered at all, yet JConsole uses iteration order to build 
> the path, so you may get
> 
> acme/ao/MyMetric or MyMetric/acme/ao or .....
> 
> This means if you really want to have ordered packages, you have to derive 
> from Hashtable, and override the entrySet() method, including that set's 
> iterator() to return the values in the order you wish to have them shown.
> 
> That is really janky.
> 
> I'm proposing that the interface for getInstance be softened to
> 
> public static ObjectName getInstance(String domain,
>                                         Map<String,String> table)
> 
> as well as
> 
> public ObjectName(String domain, Map<String, String> table)
> 
> thoughts?
> 
> 

Reply via email to