@Override public void close() throws IOException { LinuxVirtualMachine.close(s); } }
@Override public synchronized int read(byte[] bs, int off, int len) throws IOException { if (off < 0 || off > bs.length || len < 0 || off + len > bs.length || off + len < 0) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return 0; } return LinuxVirtualMachine.read(s, bs, off, len); }
path = findSocketFile(pid); File f = createAttachFile(pid); int mpid = getLinuxThreadsManager(pid); assert mpid >= 1; sendQuitToChildrenOf(mpid); sendQuitTo(pid); int retries = (int) (attachTimeout() / delay); path = findSocketFile(pid); i++; checkPermissions(path); int s = socket(); connect(s, path); close(s);
int s = socket(); connect(s, p); } catch (IOException x) { close(s); throw x; writeString(s, PROTOCOL_VERSION); writeString(s, cmd); writeString(s, (String)args[i]); } else { writeString(s, ""); completionStatus = readInt(sis); } catch (IOException x) { sis.close();
@SuppressWarnings({"UseOfSunClasses"}) private VirtualMachine getVirtualMachineImplementationFromEmbeddedOnes() { try { if (File.separatorChar == '\\') { return new WindowsVirtualMachine(ATTACH_PROVIDER, pid); } else { return new LinuxVirtualMachine(ATTACH_PROVIDER, pid); } } catch (AttachNotSupportedException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } catch (UnsatisfiedLinkError ignore) { //noinspection ThrowInsideCatchBlockWhichIgnoresCaughtException throw new IllegalStateException( "Unable to load Java agent; please add lib/tools.jar from your JDK to the classpath"); } }
path = findSocketFile(pid); if (path == null) { File f = createAttachFile(pid); try { int mpid; try { mpid = getLinuxThreadsManager(pid); } catch (IOException x) { throw new AttachNotSupportedException(x.getMessage()); sendQuitToChildrenOf(mpid); } else { sendQuitTo(pid); int retries = (int)(attachTimeout() / delay); do { try { Thread.sleep(delay); } catch (InterruptedException x) { } path = findSocketFile(pid); i++; } while (i <= retries && path == null); checkPermissions(path); int s = socket(); try { connect(s, path);
int s = socket(); connect(s, p); close(s); throw x; writeString(s, PROTOCOL_VERSION); writeString(s, cmd); writeString(s, (String) args[i]); writeString(s, ""); completionStatus = readInt(sis);
private static VirtualMachine getVirtualMachineImplementationFromEmbeddedOnes(String pid) { try { if (isWindows()) { return new WindowsVirtualMachine(ATTACH_PROVIDER, pid); } String osName = System.getProperty("os.name"); if (osName.startsWith("Linux") || osName.startsWith("LINUX")) { return new LinuxVirtualMachine(ATTACH_PROVIDER, pid); } else if (osName.startsWith("Mac OS X")) { return new BsdVirtualMachine(ATTACH_PROVIDER, pid); } else if (osName.startsWith("Solaris")) { return new SolarisVirtualMachine(ATTACH_PROVIDER, pid); } } catch (AttachNotSupportedException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } catch (UnsatisfiedLinkError e) { throw new IllegalStateException("Native library for Attach API not available in this JRE", e); } return null; }
private static VirtualMachine getVirtualMachineImplementationFromEmbeddedOnes(String pid) { try { if (isWindows()) { return new WindowsVirtualMachine(ATTACH_PROVIDER, pid); } String osName = System.getProperty("os.name"); if (osName.startsWith("Linux") || osName.startsWith("LINUX")) { return new LinuxVirtualMachine(ATTACH_PROVIDER, pid); } else if (osName.startsWith("Mac OS X")) { return new BsdVirtualMachine(ATTACH_PROVIDER, pid); } else if (osName.startsWith("Solaris")) { return new SolarisVirtualMachine(ATTACH_PROVIDER, pid); } } catch (AttachNotSupportedException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } catch (UnsatisfiedLinkError e) { throw new IllegalStateException("Native library for Attach API not available in this JRE", e); } return null; }
@Override public synchronized int read(byte[] bs, int off, int len) throws IOException { if ((off < 0) || (off > bs.length) || (len < 0) || ((off + len) > bs.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); } else if (len == 0) return 0; return LinuxVirtualMachine.read(s, bs, off, len); }
@Override public void close() throws IOException { LinuxVirtualMachine.close(s); } }
private static VirtualMachine getVirtualMachineImplementationFromEmbeddedOnes(String pid) { try { if (isWindows()) { return new WindowsVirtualMachine(ATTACH_PROVIDER, pid); } String osName = System.getProperty("os.name"); if (osName.startsWith("Linux") || osName.startsWith("LINUX")) { return new LinuxVirtualMachine(ATTACH_PROVIDER, pid); } else if (osName.startsWith("Mac OS X")) { return new BsdVirtualMachine(ATTACH_PROVIDER, pid); } else if (osName.startsWith("Solaris")) { return new SolarisVirtualMachine(ATTACH_PROVIDER, pid); } } catch (AttachNotSupportedException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } catch (UnsatisfiedLinkError e) { throw new IllegalStateException("Native library for Attach API not available in this JRE", e); } return null; }