JMXConnectorServerFactory (Java Platform SE 8 ) (original) (raw)

Factory to create JMX API connector servers. There are no instances of this class.

Each connector server is created by an instance of JMXConnectorServerProvider. This instance is found as follows. Suppose the given JMXServiceURL looks like"service:jmx:_protocol_:_remainder_". Then the factory will attempt to find the appropriate JMXConnectorServerProvider for _protocol_. Each occurrence of the character + or - in_protocol_ is replaced by . or_, respectively.

A provider package list is searched for as follows:

  1. If the environment parameter to newJMXConnectorServer contains the keyjmx.remote.protocol.provider.pkgs then the associated value is the provider package list.
  2. Otherwise, if the system propertyjmx.remote.protocol.provider.pkgs exists, then its value is the provider package list.
  3. Otherwise, there is no provider package list.

The provider package list is a string that is interpreted as a list of non-empty Java package names separated by vertical bars (|). If the string is empty, then so is the provider package list. If the provider package list is not a String, or if it contains an element that is an empty string, a JMXProviderException is thrown.

If the provider package list exists and is not empty, then for each element _pkg_ of the list, the factory will attempt to load the class

_pkg_._protocol_.ServerProvider

If the environment parameter to newJMXConnectorServer contains the keyjmx.remote.protocol.provider.class.loader then the associated value is the class loader to use to load the provider. If the associated value is not an instance of ClassLoader, an IllegalArgumentException is thrown.

If the jmx.remote.protocol.provider.class.loader key is not present in the environment parameter, the calling thread's context class loader is used.

If the attempt to load this class produces a ClassNotFoundException, the search for a handler continues with the next element of the list.

Otherwise, a problem with the provider found is signalled by aJMXProviderException whose cause indicates the underlying exception, as follows:

If no provider is found by the above steps, including the default case where there is no provider package list, then the implementation will use its own provider for_protocol_, or it will throw aMalformedURLException if there is none. An implementation may choose to find providers by other means. For example, it may support the [ JAR conventions for service providers](../../../../technotes/guides/jar/jar.html#Service Provider), where the service interface is JMXConnectorServerProvider.

Every implementation must support the RMI connector protocol with the default RMI transport, specified with string rmi. An implementation may optionally support the RMI connector protocol with the RMI/IIOP transport, specified with the stringiiop.

Once a provider is found, the result of thenewJMXConnectorServer method is the result of callingnewJMXConnectorServer on the provider.

The Map parameter passed to theJMXConnectorServerProvider is a new read-onlyMap that contains all the entries that were in theenvironment parameter to JMXConnectorServerFactory.newJMXConnectorServer, if there was one. Additionally, if thejmx.remote.protocol.provider.class.loader key is not present in the environment parameter, it is added to the new read-only Map. The associated value is the calling thread's context class loader.