changeset 4346:62d3e2c51aa8

7065972: Some race condition may happen in SSLSocketImpl class Reviewed-by: wetmore, weijun, dgu
author xuelei
date Tue, 09 Aug 2011 22:03:20 -0700
parents 8841e2149dfb
children 2c93c0965f99
files src/share/classes/sun/security/ssl/SSLSocketImpl.java
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/security/ssl/SSLSocketImpl.java	Tue Aug 09 14:02:15 2011 +0100
+++ b/src/share/classes/sun/security/ssl/SSLSocketImpl.java	Tue Aug 09 22:03:20 2011 -0700
@@ -2443,11 +2443,12 @@
             entrySet, HandshakeCompletedEvent e) {
 
             super("HandshakeCompletedNotify-Thread");
-            targets = entrySet;
+            targets = new HashSet<>(entrySet);          // clone the entry set
             event = e;
         }
 
         public void run() {
+            // Don't need to synchronize, as it only runs in one thread.
             for (Map.Entry<HandshakeCompletedListener,AccessControlContext>
                 entry : targets) {