提交 7ff8c3fd 编写于 作者: C coffeys

8059588: deadlock in java/io/PrintStream when verbose java.security.debug flags are set

Reviewed-by: mullan
上级 986c06cc
...@@ -90,6 +90,7 @@ final class SessionManager { ...@@ -90,6 +90,7 @@ final class SessionManager {
// maximum number of active sessions during this invocation, for debugging // maximum number of active sessions during this invocation, for debugging
private int maxActiveSessions; private int maxActiveSessions;
private Object maxActiveSessionsLock;
// flags to use in the C_OpenSession() call // flags to use in the C_OpenSession() call
private final long openSessionFlags; private final long openSessionFlags;
...@@ -113,6 +114,9 @@ final class SessionManager { ...@@ -113,6 +114,9 @@ final class SessionManager {
this.token = token; this.token = token;
this.objSessions = new Pool(this); this.objSessions = new Pool(this);
this.opSessions = new Pool(this); this.opSessions = new Pool(this);
if (debug != null) {
maxActiveSessionsLock = new Object();
}
} }
// returns whether only a fairly low number of sessions are // returns whether only a fairly low number of sessions are
...@@ -212,7 +216,7 @@ final class SessionManager { ...@@ -212,7 +216,7 @@ final class SessionManager {
Session session = new Session(token, id); Session session = new Session(token, id);
activeSessions.incrementAndGet(); activeSessions.incrementAndGet();
if (debug != null) { if (debug != null) {
synchronized(this) { synchronized(maxActiveSessionsLock) {
if (activeSessions.get() > maxActiveSessions) { if (activeSessions.get() > maxActiveSessions) {
maxActiveSessions = activeSessions.get(); maxActiveSessions = activeSessions.get();
if (maxActiveSessions % 10 == 0) { if (maxActiveSessions % 10 == 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册