Author: dehort
Date: 2013-10-29 14:28:00 -0400 (Tue, 29 Oct 2013)
New Revision: 2297
Modified:
branches/7.3.x/src/main/java/org/apache/tomcat/util/net/jsse/JSSESupport.java
Log:
bz-1024481 - JBossWeb memory leak when using SSL + Java security manager
Modified: branches/7.3.x/src/main/java/org/apache/tomcat/util/net/jsse/JSSESupport.java
===================================================================
---
branches/7.3.x/src/main/java/org/apache/tomcat/util/net/jsse/JSSESupport.java 2013-10-29
18:06:11 UTC (rev 2296)
+++
branches/7.3.x/src/main/java/org/apache/tomcat/util/net/jsse/JSSESupport.java 2013-10-29
18:28:00 UTC (rev 2297)
@@ -25,6 +25,8 @@
import java.net.SocketException;
import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;
+import java.util.Map;
+import java.util.WeakHashMap;
import javax.net.ssl.HandshakeCompletedEvent;
import javax.net.ssl.HandshakeCompletedListener;
@@ -57,6 +59,9 @@
protected SSLSocket ssl;
protected SSLSession session;
+ private static final Map<SSLSession, Integer> keySizeCache =
+ new WeakHashMap<SSLSession, Integer>(10);
+
Listener listener = new Listener();
JSSESupport(SSLSocket sock){
@@ -200,7 +205,7 @@
SSLSupport.CipherData c_aux[]=ciphers;
if (session == null)
return null;
- Integer keySize = (Integer) session.getValue(Constants.KEY_SIZE_KEY);
+ Integer keySize = (Integer) keySizeCache.get(session);
if (keySize == null) {
int size = 0;
String cipherSuite = session.getCipherSuite();
@@ -211,7 +216,7 @@
}
}
keySize = new Integer(size);
- session.putValue(Constants.KEY_SIZE_KEY, keySize);
+ keySizeCache.put(session, keySize);
}
return keySize;
}
Show replies by date