changeset 10128:f505a8514bd7

7065972: Some race condition may happen in SSLSocketImpl class Reviewed-by: wetmore, weijun, dgu
author xuelei
date Tue, 19 Jul 2011 21:47:23 -0700
parents c85d1ec57ee7
children bf705e446ca1
files jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java	Tue Jul 19 17:45:11 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java	Tue Jul 19 21:47:23 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) {