Log Message
Register CompositeClassLoader in Java 7 as parallel capable (XSTR-742).
Modified Paths
Diff
Modified: trunk/xstream/src/java/com/thoughtworks/xstream/core/util/CompositeClassLoader.java (2108 => 2109)
--- trunk/xstream/src/java/com/thoughtworks/xstream/core/util/CompositeClassLoader.java 2013-09-03 19:53:36 UTC (rev 2108)
+++ trunk/xstream/src/java/com/thoughtworks/xstream/core/util/CompositeClassLoader.java 2013-09-07 16:32:41 UTC (rev 2109)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2004, 2005 Joe Walnes.
- * Copyright (C) 2006, 2007, 2011 XStream Committers.
+ * Copyright (C) 2006, 2007, 2011, 2013 XStream Committers.
* All rights reserved.
*
* The software in this package is published under the terms of the BSD
@@ -13,11 +13,14 @@
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import com.thoughtworks.xstream.core.JVM;
+
/**
* ClassLoader that is composed of other classloaders. Each loader will be used to try to load the particular class, until
* one of them succeeds. <b>Note:</b> The loaders will always be called in the REVERSE order they were added in.
@@ -49,6 +52,18 @@
* @since 1.0.3
*/
public class CompositeClassLoader extends ClassLoader {
+ static {
+ if (JVM.is17()) {
+ // see http://www.cs.duke.edu/csed/java/jdk1.7/technotes/guides/lang/cl-mt.html
+ try {
+ Method m = ClassLoader.class.getDeclaredMethod("registerAsParallelCapable");
+ m.setAccessible(true);
+ m.invoke(null);
+ } catch (Exception e) {
+ // ignore errors, JVM will synchronize class for Java 7 or higher
+ }
+ }
+ }
private final ReferenceQueue queue = new ReferenceQueue();
private final List classLoaders = new ArrayList();
Modified: trunk/xstream-distribution/src/content/changes.html (2108 => 2109)
--- trunk/xstream-distribution/src/content/changes.html 2013-09-03 19:53:36 UTC (rev 2108)
+++ trunk/xstream-distribution/src/content/changes.html 2013-09-07 16:32:41 UTC (rev 2109)
@@ -79,6 +79,7 @@
<li>JIRA:XSTR-578: Implement support for aliasing in JavaClasConverter, JavaFieldConverter and
JavaMethodConverter. While it is not possible to enable this in general, new constructors have been added to
these converters and an example in the acceptance tests (AliasTest).</li>
+ <li>JIRA:XSTR-742: Register CompositeClassLoader in Java 7 as parallel capable.</li>
<li>JIRA:XSTR-743: Support proxy collections of Hibernate Envers.</li>
</ul>
Modified: trunk/xstream-distribution/src/content/team.html (2108 => 2109)
--- trunk/xstream-distribution/src/content/team.html 2013-09-03 19:53:36 UTC (rev 2108)
+++ trunk/xstream-distribution/src/content/team.html 2013-09-07 16:32:41 UTC (rev 2109)
@@ -117,6 +117,7 @@
<li>Kohsuke Kawaguchi</li>
<li>Peter Abeles</li>
<li>Edison Guo</li>
+ <li>Rico Neubauer</li>
</ul>
<p>Please direct all correspondence about XStream to the <a href="" mailing lists</a>
To unsubscribe from this list please visit:
