src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java
changeset 55685 56b96d234f26
parent 54065 f984aca565c1
child 57844 3bc26ffdf001
equal deleted inserted replaced
55684:000138a6a4b3 55685:56b96d234f26
     1 /*
     1 /*
     2  * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * Copyright (c) 2015, 2018, SAP SE. All rights reserved.
     3  * Copyright (c) 2015, 2019, SAP SE. All rights reserved.
     4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5  *
     5  *
     6  * This code is free software; you can redistribute it and/or modify it
     6  * This code is free software; you can redistribute it and/or modify it
     7  * under the terms of the GNU General Public License version 2 only, as
     7  * under the terms of the GNU General Public License version 2 only, as
     8  * published by the Free Software Foundation.  Oracle designates this
     8  * published by the Free Software Foundation.  Oracle designates this
   252                 return 0;
   252                 return 0;
   253 
   253 
   254             return VirtualMachineImpl.read(s, bs, off, len);
   254             return VirtualMachineImpl.read(s, bs, off, len);
   255         }
   255         }
   256 
   256 
   257         public void close() throws IOException {
   257         public synchronized void close() throws IOException {
   258             VirtualMachineImpl.close(s);
   258             if (s != -1) {
       
   259                 int toClose = s;
       
   260                 s = -1;
       
   261                 VirtualMachineImpl.close(toClose);
       
   262             }
   259         }
   263         }
   260     }
   264     }
   261 
   265 
   262     // On Aix a simple handshake is used to start the attach mechanism
   266     // On Aix a simple handshake is used to start the attach mechanism
   263     // if not already started. The client creates a .attach_pid<pid> file in the
   267     // if not already started. The client creates a .attach_pid<pid> file in the