diff --git a/jdk/src/share/classes/java/lang/ClassLoader.java b/jdk/src/share/classes/java/lang/ClassLoader.java index fd9ba91d720..ce7f0e655e8 100644 --- a/jdk/src/share/classes/java/lang/ClassLoader.java +++ b/jdk/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.