- java.lang.Object
-
- javax.management.remote.JMXConnectorFactory
-
public class JMXConnectorFactory extends Object
Factory to create JMX API connector clients. There are no instances of this class.
Connections are usually made using the
connect
method of this class. More advanced applications can separate the creation of the connector client, usingnewJMXConnector
and the establishment of the connection itself, usingJMXConnector.connect(Map)
.Each client is created by an instance of
JMXConnectorProvider
. This instance is found as follows. Suppose the givenJMXServiceURL
looks like"service:jmx:protocol:remainder"
. Then the factory will attempt to find the appropriateJMXConnectorProvider
forprotocol
. Each occurrence of the character+
or-
inprotocol
is replaced by.
or_
, respectively.A provider package list is searched for as follows:
- If the
environment
parameter tonewJMXConnector
contains the keyjmx.remote.protocol.provider.pkgs
then the associated value is the provider package list. - Otherwise, if the system property
jmx.remote.protocol.provider.pkgs
exists, then its value is the provider package list. - 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, aJMXProviderException
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 classpkg.protocol.ClientProvider
If the
environment
parameter tonewJMXConnector
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 ofClassLoader
, anIllegalArgumentException
is thrown.If the
jmx.remote.protocol.provider.class.loader
key is not present in theenvironment
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
whosecause
indicates the underlying exception, as follows:- if the attempt to load the class produces an exception other
than
ClassNotFoundException
, that is the cause; - if
Class.newInstance()
for the class produces an exception, that is the cause.
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, where the service interface isJMXConnectorProvider
.Every implementation must support the RMI connector protocols, specified with the string
rmi
oriiop
.Once a provider is found, the result of the
newJMXConnector
method is the result of callingnewJMXConnector
on the provider.The
Map
parameter passed to theJMXConnectorProvider
is a new read-onlyMap
that contains all the entries that were in theenvironment
parameter toJMXConnectorFactory.newJMXConnector
, if there was one. Additionally, if thejmx.remote.protocol.provider.class.loader
key is not present in theenvironment
parameter, it is added to the new read-onlyMap
. The associated value is the calling thread's context class loader.- Since:
- 1.5
- If the
-
-
Field Summary
Fields Modifier and Type Field and Description static String
DEFAULT_CLASS_LOADER
Name of the attribute that specifies the default class loader.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
Methods Modifier and Type Method and Description static JMXConnector
connect(JMXServiceURL serviceURL)
Creates a connection to the connector server at the given address.static JMXConnector
connect(JMXServiceURL serviceURL, Map<String,?> environment)
Creates a connection to the connector server at the given address.static JMXConnector
newJMXConnector(JMXServiceURL serviceURL, Map<String,?> environment)
Creates a connector client for the connector server at the given address.
-
-
-
Field Detail
-
DEFAULT_CLASS_LOADER
public static final String DEFAULT_CLASS_LOADER
Name of the attribute that specifies the default class loader. This class loader is used to deserialize return values and exceptions from remote
MBeanServerConnection
calls. The value associated with this attribute is an instance ofClassLoader
.- See Also:
- Constant Field Values
-
PROTOCOL_PROVIDER_PACKAGES
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 (
|
).- See Also:
- Constant Field Values
-
PROTOCOL_PROVIDER_CLASS_LOADER
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
.- See Also:
- Constant Field Values
-
-
Method Detail
-
connect
public static JMXConnector connect(JMXServiceURL serviceURL) throws IOException
Creates a connection to the connector server at the given address.
This method is equivalent to
connect(serviceURL, null)
.- Parameters:
serviceURL
- the address of the connector server to connect to.- Returns:
- a
JMXConnector
whoseconnect
method has been called. - Throws:
NullPointerException
- ifserviceURL
is null.IOException
- if the connector client or the connection cannot be made because of a communication problem.SecurityException
- if the connection cannot be made for security reasons.
-
connect
public static JMXConnector connect(JMXServiceURL serviceURL, Map<String,?> environment) throws IOException
Creates a connection to the connector server at the given address.
This method is equivalent to:
JMXConnector conn = JMXConnectorFactory.newJMXConnector(serviceURL, environment); conn.connect(environment);
- Parameters:
serviceURL
- the address of the connector server to connect to.environment
- a set of attributes to determine how the connection is made. This parameter can be null. Keys in this map must be Strings. The appropriate type of each associated value depends on the attribute. The contents ofenvironment
are not changed by this call.- Returns:
- a
JMXConnector
representing the newly-made connection. Each successful call to this method produces a different object. - Throws:
NullPointerException
- ifserviceURL
is null.IOException
- if the connector client or the connection cannot be made because of a communication problem.SecurityException
- if the connection cannot be made for security reasons.
-
newJMXConnector
public static JMXConnector newJMXConnector(JMXServiceURL serviceURL, Map<String,?> environment) throws IOException
Creates a connector client for the connector server at the given address. The resultant client is not connected until its
connect
method is called.- Parameters:
serviceURL
- the address of the connector server to connect to.environment
- a set of attributes to determine how the connection is made. This parameter can be null. Keys in this map must be Strings. The appropriate type of each associated value depends on the attribute. The contents ofenvironment
are not changed by this call.- Returns:
- a
JMXConnector
representing the new connector client. Each successful call to this method produces a different object. - Throws:
NullPointerException
- ifserviceURL
is null.IOException
- if the connector client cannot be made because of a communication problem.MalformedURLException
- if there is no provider for the protocol inserviceURL
.JMXProviderException
- if there is a provider for the protocol inserviceURL
but it cannot be used for some reason.
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-javax/management/remote/jmxconnectorfactory.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.