Class JmxUtil


  • public final class JmxUtil
    extends java.lang.Object
    Utility methods related to JMX
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static @NotNull java.util.Map<java.lang.String,​javax.management.ObjectName> createObjectNameMap​(@NotNull java.lang.String type, @NotNull java.lang.String name, @NotNull java.util.Map<java.lang.String,​java.lang.String> properties)
      Constructs an immutable map with a single "jmx.objectname" key and a new ObjectName as value.
      static java.lang.String quoteValueIfRequired​(java.lang.String unquotedValue)
      Checks if the passed value string can be used as is as part of JMX ObjectName If it cannot be used then it would return a quoted string which is then safe to be used as part of ObjectName.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • quoteValueIfRequired

        public static java.lang.String quoteValueIfRequired​(java.lang.String unquotedValue)
        Checks if the passed value string can be used as is as part of JMX ObjectName If it cannot be used then it would return a quoted string which is then safe to be used as part of ObjectName.

        This is meant to avoid unnecessary quoting of value

        Parameters:
        unquotedValue - to quote if required
        Returns:
        passed value or quoted value if required
      • createObjectNameMap

        @NotNull
        public static @NotNull java.util.Map<java.lang.String,​javax.management.ObjectName> createObjectNameMap​(@NotNull
                                                                                                                     @NotNull java.lang.String type,
                                                                                                                     @NotNull
                                                                                                                     @NotNull java.lang.String name,
                                                                                                                     @NotNull
                                                                                                                     @NotNull java.util.Map<java.lang.String,​java.lang.String> properties)
                                                                                                              throws javax.management.MalformedObjectNameException
        Constructs an immutable map with a single "jmx.objectname" key and a new ObjectName as value. The domain of the ObjectName will be WhiteboardUtils.JMX_OAK_DOMAIN. Note that property values as well as the given type and name will get quoted according to quoteValueIfRequired(String).
        Parameters:
        type - The type of bean
        name - The name of the bean
        properties - A map of additional properties
        Returns:
        An immutable map with key "jmx.objectname" and a new ObjectName constructed from the parameters.
        Throws:
        javax.management.MalformedObjectNameException - If constructing the ObjectName fails.