--- a/jdk/src/share/classes/java/util/concurrent/Executors.java Wed Aug 15 15:31:30 2012 -0400
+++ b/jdk/src/share/classes/java/util/concurrent/Executors.java Thu Aug 16 15:02:34 2012 +0100
@@ -530,18 +530,17 @@
return AccessController.doPrivileged(
new PrivilegedExceptionAction<T>() {
public T run() throws Exception {
- ClassLoader savedcl = null;
Thread t = Thread.currentThread();
- try {
- ClassLoader cl = t.getContextClassLoader();
- if (ccl != cl) {
- t.setContextClassLoader(ccl);
- savedcl = cl;
+ ClassLoader cl = t.getContextClassLoader();
+ if (ccl == cl) {
+ return task.call();
+ } else {
+ t.setContextClassLoader(ccl);
+ try {
+ return task.call();
+ } finally {
+ t.setContextClassLoader(cl);
}
- return task.call();
- } finally {
- if (savedcl != null)
- t.setContextClassLoader(savedcl);
}
}
}, acc);