changeset 305:41007cd99ae8

7901711: ConcurrentModificationException at org.openjdk.jcstress.link.BinaryLinkServer.terminate Summary: Do not try to remove handlers while iterating through the collection.
author shade
date Mon, 11 Jul 2016 23:33:44 +0300
parents b937698bcb0c
children d05bb19014cd
files jcstress-core/src/main/java/org/openjdk/jcstress/link/BinaryLinkServer.java
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/link/BinaryLinkServer.java	Tue Jul 05 14:42:47 2016 +0300
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/link/BinaryLinkServer.java	Mon Jul 11 23:33:44 2016 +0300
@@ -77,6 +77,8 @@
         } catch (InterruptedException e) {
             // ignore
         }
+
+        handlers.clear();
     }
 
     private InetAddress getListenAddress() {
@@ -200,6 +202,7 @@
                 e.printStackTrace(System.out);
             } finally {
                 close();
+                handlers.remove(this);
             }
         }
 
@@ -222,7 +225,6 @@
             } catch (IOException e) {
                 // ignore
             }
-            BinaryLinkServer.this.handlers.remove(this);
         }
 
     }