src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java
changeset 55443 99b604ec1af6
parent 54065 f984aca565c1
child 55685 56b96d234f26
equal deleted inserted replaced
55442:12e8433e2581 55443:99b604ec1af6
   231 
   231 
   232     /*
   232     /*
   233      * InputStream for the socket connection to get target VM
   233      * InputStream for the socket connection to get target VM
   234      */
   234      */
   235     private class SocketInputStream extends InputStream {
   235     private class SocketInputStream extends InputStream {
   236         int s;
   236         int s = -1;
   237 
   237 
   238         public SocketInputStream(int s) {
   238         public SocketInputStream(int s) {
   239             this.s = s;
   239             this.s = s;
   240         }
   240         }
   241 
   241 
   259 
   259 
   260             return VirtualMachineImpl.read(s, bs, off, len);
   260             return VirtualMachineImpl.read(s, bs, off, len);
   261         }
   261         }
   262 
   262 
   263         public void close() throws IOException {
   263         public void close() throws IOException {
   264             VirtualMachineImpl.close(s);
   264             synchronized (this) {
       
   265                 if (s != -1) {
       
   266                     VirtualMachineImpl.close(s);
       
   267                     s = -1;
       
   268                 }
       
   269             }
   265         }
   270         }
   266     }
   271     }
   267 
   272 
   268     // Return the socket file for the given process.
   273     // Return the socket file for the given process.
   269     private File findSocketFile(int pid, int ns_pid) {
   274     private File findSocketFile(int pid, int ns_pid) {