Dump services webrev
Paul Sandoz
paul.sandoz at oracle.com
Tue May 29 01:53:39 PDT 2012
On May 25, 2012, at 7:09 PM, Mandy Chung wrote:
> iOn 5/25/2012 1:45 AM, Paul Sandoz wrote:
>> Hi,
>>
>> See the following for a webrev to dump the services configuration:
>>
>> http://cr.openjdk.java.net/~psandoz/jigsaw/dump-services/webrev/
>
> Configuration.java - looks good. this is useful to list the service providers in dump-config. L148: formatting nit: the argument to be aligned with the argument in L147 and '{' begins in next line.
>
I presume the best practice is to stick to the same style in the source itself. Is there a recommended style guide available? any tools to help apply such a guide (e.g. in NetBeans)?
See end of email for a diff of this code (correct formatting requires viewing in a fixed space font). Let's leave the rest of the code changes out of this revision.
> jdk.depconfig, JConsole.java: as we suggest, best would be to keep the -pluginpath as an option to run in classpath mode and output an error when -pluginpath is used. For now, the error message should suggest to run jconsole with -Xmode:classpath option (we should rename the current -Xmode:legacy launcher flag).
>
OK.
> Charset.java - this change seems to be a leftover from the previous webrev - do you mean to revert it?
>
No, i just removed an unused field.
> RenderingEngine.java - I suspect the system property was for testing and Phil will confirm.
>
> FYI. W.r.t. using a system property to override an implementation class, this property mechanism is also used place that does not call ServiceLoader (probably was added predated the service loader mechanism). A while back, I annotated the jdk source to record the non-static dependencies (the webrev was based on jdk7-b72 and need update):
> http://cr.openjdk.java.net/~mchung/jigsaw/annotated_jdk_webrev/
>
Did you use some tool to help identify and make code changes?
> It included the system property if it supports this property mechanism (some examples):
> @ClassForName(value={""}, property="com.sun.net.httpserver.HttpServerProvider")
> @ClassForName(value={"sun.net.www.protocol.*.Handler"}, property="java.protocol.handler.pkgs")
> @ClassForName(value={"sun.net.www.content.*"}, property="java.content.handler.pkgs")
> @ClassForName(value={""}, property="java.nio.channels.spi.AsynchronousChannelProvider")
> @ClassForName(value={"sun.nio.ch.DefaultSelectorProvider"}, property="java.nio.channels.spi.SelectorProvider")
> @ClassForName(value={""}, property="java.rmi.server.RMIClassLoaderSpi")
> @ClassForName(value={"sun.security.provider.IdentityDatabase"}, property="system.scope", required=false)
> @ClassForName(value={"sun.security.provider.PolicyFile"}, property="policy.provider")
> @ClassForName(value={"java.security.*Spi"}, property="", required=false)
> @ClassForName(value={""}, property="jdbc.drivers")
> @ClassForName(value={}, property="java.util.jar.Pack200.*")
> @ClassForName(value={""}, property="ssl.ServerSocketFactory.provider")
> @ClassForName(value={""}, property="ssl.SocketFactory.provider")
>
> Some are supported and some are private jdk implementation. Anyway, we will have to go through them case by case.
>
Yes, tricky work.
Paul.
> Mandy
jdk $ hg diff src/share/classes/org/openjdk/jigsaw/Configuration.java
diff -r 1690f9dd8ebd src/share/classes/org/openjdk/jigsaw/Configuration.java
--- a/src/share/classes/org/openjdk/jigsaw/Configuration.java Fri May 18 12:55:26 2012 -0700
+++ b/src/share/classes/org/openjdk/jigsaw/Configuration.java Tue May 29 10:42:15 2012 +0200
@@ -144,7 +144,27 @@
this.contextForName = new HashMap<String,Cx>();
}
+ private void dumpServices(String title, Map<String,Set<String>> services,
+ PrintStream out)
+ {
+ if (!services.isEmpty()) {
+ out.format(" %s (%d)%n", title, services.size());
+
+ for (Map.Entry<String, Set<String>> service : services.entrySet()) {
+ Set<String> names = service.getValue();
+ out.format(" %s (%d)%n", service.getKey(), names.size());
+ for (String name : names) {
+ out.format(" %s%n", name);
+ }
+ }
+ }
+ }
+
private void dump(Context cx, boolean all, PrintStream out) {
+ dumpServices("local service providers", cx.services(), out);
+
+ dumpServices("remote service suppliers", cx.serviceSuppliers(), out);
+
if (!cx.localClasses().isEmpty()) {
Set<String> classes = new TreeSet<>(cx.localClasses());
out.format(" local (%d)", classes.size());
More information about the jigsaw-dev
mailing list