java.lang.Objectjavax.management.remote.JMXConnectorServerFactory
public class JMXConnectorServerFactory
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:
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 key jmx.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 a JMXProviderException 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 a MalformedURLException 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
JAR conventions for service providers
, where the service interface is JMXConnectorServerProvider.
Every implementation must support the RMI connector protocols, specified with the string rmi or iiop.
Once a provider is found, the result of the newJMXConnectorServer method is the result of calling newJMXConnectorServer on the provider.
The Map parameter passed to the JMXConnectorServerProvider is a new read-only Map that contains all the entries that were in the environment parameter to JMXConnectorServerFactory.newJMXConnectorServer , if there was one. Additionally, if the jmx.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.
Field Summary | |
---|---|
static String |
DEFAULT_CLASS_LOADER
Name of the attribute that specifies the default class loader. |
static String |
DEFAULT_CLASS_LOADER_NAME
Name of the attribute that specifies the default class loader MBean name. |
static String |
PROTOCOL_PROVIDER_CLASS_LOADER
Name of the attribute that specifies the class loader for loading protocol providers. |
static String |
PROTOCOL_PROVIDER_PACKAGES
Name of the attribute that specifies the provider packages that are consulted when looking for the handler for a protocol. |
Method Summary | |
---|---|
static JMXConnectorServer |
newJMXConnectorServer
(
JMXServiceURL
serviceURL,
Map
<
String
,?> environment,
MBeanServer
mbeanServer) Creates a connector server at the given address. |
Methods inherited from class java.lang. Object |
---|
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
Field Detail |
---|
public static final String DEFAULT_CLASS_LOADER
Name of the attribute that specifies the default class loader. This class loader is used to deserialize objects in requests received from the client, possibly after consulting an MBean-specific class loader. The value associated with this attribute is an instance of ClassLoader .
public static final String DEFAULT_CLASS_LOADER_NAME
Name of the attribute that specifies the default class loader MBean name. This class loader is used to deserialize objects in requests received from the client, possibly after consulting an MBean-specific class loader. The value associated with this attribute is an instance of ObjectName .
public static final String PROTOCOL_PROVIDER_PACKAGES
Name of the attribute that specifies the provider packages that are consulted when looking for the handler for a protocol. The value associated with this attribute is a string with package names separated by vertical bars (|).
public static final String PROTOCOL_PROVIDER_CLASS_LOADER
Name of the attribute that specifies the class loader for loading protocol providers. The value associated with this attribute is an instance of ClassLoader .
Method Detail |
---|
public static JMXConnectorServer newJMXConnectorServer(JMXServiceURL serviceURL, Map<String,?> environment, MBeanServer mbeanServer) throws IOException
Creates a connector server at the given address. The resultant server is not started until its start method is called.