jdk/src/share/classes/sun/nio/ch/Invoker.java
changeset 23894 7500e0f62a4a
parent 5506 202f599c92aa
--- a/jdk/src/share/classes/sun/nio/ch/Invoker.java	Fri Dec 20 15:43:41 2013 +0400
+++ b/jdk/src/share/classes/sun/nio/ch/Invoker.java	Thu Dec 19 12:14:04 2013 +0000
@@ -130,6 +130,18 @@
 
         // clear interrupt
         Thread.interrupted();
+
+        // clear thread locals when in default thread pool
+        if (System.getSecurityManager() != null) {
+            Thread me = Thread.currentThread();
+            if (me instanceof sun.misc.InnocuousThread) {
+                GroupAndInvokeCount thisGroupAndInvokeCount = myGroupAndInvokeCount.get();
+                ((sun.misc.InnocuousThread)me).eraseThreadLocals();
+                if (thisGroupAndInvokeCount != null) {
+                    myGroupAndInvokeCount.set(thisGroupAndInvokeCount);
+                }
+            }
+        }
     }
 
     /**