src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java
changeset 55685 56b96d234f26
parent 55443 99b604ec1af6
child 57844 3bc26ffdf001
--- a/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java	Mon Jul 15 03:14:28 2019 +0000
+++ b/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java	Tue Jul 16 13:57:13 2019 +0200
@@ -260,12 +260,11 @@
             return VirtualMachineImpl.read(s, bs, off, len);
         }
 
-        public void close() throws IOException {
-            synchronized (this) {
-                if (s != -1) {
-                    VirtualMachineImpl.close(s);
-                    s = -1;
-                }
+        public synchronized void close() throws IOException {
+            if (s != -1) {
+                int toClose = s;
+                s = -1;
+                VirtualMachineImpl.close(toClose);
             }
         }
     }