changeset 29719:e974c6e3e0b2

8059588: deadlock in java/io/PrintStream when verbose javax.net.debug flags are set Reviewed-by: mullan
author coffeys
date Fri, 27 Mar 2015 19:13:47 +0000
parents d0e9a4ece867
children 374070bf0fdf
files jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/SessionManager.java
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/SessionManager.java	Thu Mar 26 19:25:48 2015 -0400
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/SessionManager.java	Fri Mar 27 19:13:47 2015 +0000
@@ -90,6 +90,7 @@
 
     // maximum number of active sessions during this invocation, for debugging
     private int maxActiveSessions;
+    private Object maxActiveSessionsLock;
 
     // flags to use in the C_OpenSession() call
     private final long openSessionFlags;
@@ -113,6 +114,9 @@
         this.token = token;
         this.objSessions = new Pool(this);
         this.opSessions = new Pool(this);
+        if (debug != null) {
+            maxActiveSessionsLock = new Object();
+        }
     }
 
     // returns whether only a fairly low number of sessions are
@@ -212,7 +216,7 @@
         Session session = new Session(token, id);
         activeSessions.incrementAndGet();
         if (debug != null) {
-            synchronized(this) {
+            synchronized(maxActiveSessionsLock) {
                 if (activeSessions.get() > maxActiveSessions) {
                     maxActiveSessions = activeSessions.get();
                     if (maxActiveSessions % 10 == 0) {