From 6a632e548b88b2594cd99f38ed5913debd4b3670 Mon Sep 17 00:00:00 2001 From: valeriep Date: Tue, 12 Oct 2010 17:05:28 -0700 Subject: [PATCH] 6887853: javadoc for java.lang.Classloader should be more clear Summary: Updated the relevant javadoc description of java.lang.ClassLoader class w/ additional clarification. Reviewed-by: mullan --- src/share/classes/java/lang/ClassLoader.java | 25 +++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/share/classes/java/lang/ClassLoader.java b/src/share/classes/java/lang/ClassLoader.java index fd9ba91d7..ce7f0e655 100644 --- a/src/share/classes/java/lang/ClassLoader.java +++ b/src/share/classes/java/lang/ClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -100,8 +100,11 @@ import sun.security.util.SecurityConstants; * themselves at their class initialization time by invoking the * {@link * #registerAsParallelCapable ClassLoader.registerAsParallelCapable} - * method. In environments in which the delegation model is not strictly - * hierarchical, class loaders need to be parallel capable, otherise class + * method. Note that the ClassLoader class is registered as parallel + * capable by default. However, its subclasses still need to register themselves + * if they are parallel capable.
+ * In environments in which the delegation model is not strictly + * hierarchical, class loaders need to be parallel capable, otherwise class * loading can lead to deadlocks because the loader lock is held for the * duration of the class loading process (see {@link #loadClass * loadClass} methods). @@ -1218,14 +1221,14 @@ public abstract class ClassLoader { private static native Class getCaller(int index); /** - * Registers the caller class loader as parallel capable. - * In order for the registration to succeed, all super classes - * of the caller class loader must also be registered as - * parallel capable when this method is called.

- * Note that once a class loader is registered as - * parallel capable, there is no way to change it back. - * In addition, registration should be done statically before - * any instance of the caller classloader being constructed.

+ * Registers the caller as parallel capable.

+ * The registration succeeds if and only if all of the following + * conditions are met:
+ * 1. no instance of the caller has been created

+ * 2. all of the super classes (except class Object) of the caller are + * registered as parallel capable

+ * Note that once a class loader is registered as parallel capable, there + * is no way to change it back.

* * @return true if the caller is successfully registered as * parallel capable and false if otherwise. -- GitLab