src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java
changeset 55685 56b96d234f26
parent 54065 f984aca565c1
child 57844 3bc26ffdf001
--- a/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java	Mon Jul 15 03:14:28 2019 +0000
+++ b/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java	Tue Jul 16 13:57:13 2019 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2015, 2018, SAP SE. All rights reserved.
+ * Copyright (c) 2015, 2019, SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -254,8 +254,12 @@
             return VirtualMachineImpl.read(s, bs, off, len);
         }
 
-        public void close() throws IOException {
-            VirtualMachineImpl.close(s);
+        public synchronized void close() throws IOException {
+            if (s != -1) {
+                int toClose = s;
+                s = -1;
+                VirtualMachineImpl.close(toClose);
+            }
         }
     }