jmx-dev [PATCH] JDK-6705499: Bad JMXConnectorProvider class name prevents all connections - even with standard RMI connector
Alan Bateman
Alan.Bateman at oracle.com
Wed Oct 24 07:28:17 PDT 2012
On 24/10/2012 15:15, Jaroslav Bachorik wrote:
> I am looking for review and a sponsor.
>
> Webrev is available at
> http://cr.openjdk.java.net/~jbachorik/JDK-6705499/webrev.00/
>
> The issue is caused by the way the java.util.ServiceLoader treats the
> service registration with incorrect class names. Such a service
> registration causes java.util.ServiceConfigurationError to be thrown and
> the JMXConnector(Server)Factory is not ready for this. Thanks to the
> exception all the other, potentially valid, service registrations are
> ignored.
>
> The patch makes JMXConnector(Server)Factory class ready for
> java.util.ServiceConfigurationError and when such an exception is caught
> the factory just proceeds to the next registration. If the only
> available registration causes the exception it will be rethrown at the end.
>
> Thanks,
>
> -JB-
I'm not so sure this is the right thing to do. When SCE is thrown then
there is no guarantee that you can continue and there isn't enough
information in the error to know whether it makes sense to attempt to
continue or not. We have this same issue in many areas of the platform
and I think it requires future work in ServiceLoader to help users of
the API decide whether to continue or not. Once we move to modules then
many of the reasons for SCE will go away because the list of service
provider is precomputed so there is no scanning of class paths or
parsing of configuration files at runtime. So if this one is not urgent
they it may be something to come back to again in the future.
-Alan.
More information about the serviceability-dev
mailing list