glassfish
  1. glassfish
  2. GLASSFISH-19274

Flashlight ProbeProviderRegistry.registerProbeProvider error can be more specific when it rejects a provider if due to the class having been registered already

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Trivial Trivial
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: monitoring
    • Labels:
      None
    • Environment:

      Linux

      Description

      I was doing some testing using XML providers and hit a failure processing some of the XML files:
      java.lang.IllegalStateException: Provider already mapped CamelNameTestModuleProvider:CamelNameTestModule:CamelNameTestProvider
      at org.glassfish.flashlight.impl.core.ProbeProviderRegistry.registerProbeProvider(ProbeProviderRegistry.java:104)
      at org.glassfish.flashlight.impl.provider.FlashlightProbeProviderFactory.registerProvider(FlashlightProbeProviderFactory.java:596)
      at org.glassfish.flashlight.impl.provider.FlashlightProbeProviderFactory.processXMLProbeProviders(FlashlightProbeProviderFactory.java:420)

      The error pointed me at the right XML file with a problem, but it turns out the problem was the classname in the XML file was the same as a provider already registered (and the name of the provider was OK).

      if (providerMap.putIfAbsent(qname, provider) != null)

      { throw new IllegalStateException("Provider already mapped " + qname); }

      if (classProviderMap.putIfAbsent(clz, provider) != null)

      { throw new IllegalStateException("Provider already mapped " + qname); <== This is line 104 where the exception was thrown }

      The IllegalStateException in ProbeProviderRegistry.registerProbeProvider may want to clarify that problem is that class already was mapped there for a different provider name. Ie: in this case, it was a new probe provider name, but the same class was specified. A minor thing, but I'm thinking it could really help someone that did a cut/paste of the XML there like I did to catch what was wrong about it faster.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Byron Nevins
            Reporter:
            tvlatas
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: