/** * Create a new jar file for the sole purpose of specifying an Agent-Class * to load into the JVM. * * @return absolute path to the new jar file. */ private static String createAgentJar() throws IOException { File file = File.createTempFile(InstrumentationFactory.class.getName(), ".jar"); file.deleteOnExit(); ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(file)); zout.putNextEntry(new ZipEntry("META-INF/MANIFEST.MF")); PrintWriter writer = new PrintWriter(new OutputStreamWriter(zout)); writer .println("Agent-Class: " + InstrumentationFactory.class.getName()); writer.println("Can-Redefine-Classes: true"); // IBM doesn't support retransform writer.println("Can-Retransform-Classes: " + Boolean.toString(JavaVendors.getCurrentVendor().isIBM() == false)); writer.close(); return file.getAbsolutePath(); }
/** * Create a new jar file for the sole purpose of specifying an Agent-Class * to load into the JVM. * * @return absolute path to the new jar file. */ private static String createAgentJar() throws IOException { File file = File.createTempFile(InstrumentationFactory.class.getName(), ".jar"); file.deleteOnExit(); ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(file)); zout.putNextEntry(new ZipEntry("META-INF/MANIFEST.MF")); PrintWriter writer = new PrintWriter(new OutputStreamWriter(zout)); writer .println("Agent-Class: " + InstrumentationFactory.class.getName()); writer.println("Can-Redefine-Classes: true"); // IBM doesn't support retransform writer.println("Can-Retransform-Classes: " + Boolean.toString(JavaVendors.getCurrentVendor().isIBM() == false)); writer.close(); return file.getAbsolutePath(); }
/** * Create a new jar file for the sole purpose of specifying an Agent-Class * to load into the JVM. * * @return absolute path to the new jar file. */ private static String createAgentJar() throws IOException { File file = File.createTempFile(InstrumentationFactory.class.getName(), ".jar"); file.deleteOnExit(); ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(file)); zout.putNextEntry(new ZipEntry("META-INF/MANIFEST.MF")); PrintWriter writer = new PrintWriter(new OutputStreamWriter(zout)); writer .println("Agent-Class: " + InstrumentationFactory.class.getName()); writer.println("Can-Redefine-Classes: true"); // IBM doesn't support retransform writer.println("Can-Retransform-Classes: " + Boolean.toString(JavaVendors.getCurrentVendor().isIBM() == false)); writer.close(); return file.getAbsolutePath(); }
/** * Create a new jar file for the sole purpose of specifying an Agent-Class * to load into the JVM. * * @return absolute path to the new jar file. */ private static String createAgentJar() throws IOException { File file = File.createTempFile(InstrumentationFactory.class.getName(), ".jar"); file.deleteOnExit(); ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(file)); zout.putNextEntry(new ZipEntry("META-INF/MANIFEST.MF")); PrintWriter writer = new PrintWriter(new OutputStreamWriter(zout)); writer .println("Agent-Class: " + InstrumentationFactory.class.getName()); writer.println("Can-Redefine-Classes: true"); // IBM doesn't support retransform writer.println("Can-Retransform-Classes: " + Boolean.toString(JavaVendors.getCurrentVendor().isIBM() == false)); writer.close(); return file.getAbsolutePath(); }
if (vendor.isIBM() == false) {
if (vendor.isIBM() == false) {
if (vendor.isIBM() == false) {
if (vendor.isIBM() == false) {
/** * If <b>ibm</b> is false, this private method will create a new URLClassLoader and attempt to load the * com.sun.tools.attach.VirtualMachine class from the provided toolsJar file. * * <p> * If <b>ibm</b> is true, this private method will ignore the toolsJar parameter and load the * com.ibm.tools.attach.VirtualMachine class. * * * @return The AttachAPI VirtualMachine class <br> * or null if something unexpected happened. */ private static Class<?> loadVMClass(File toolsJar, Log log, JavaVendors vendor) { try { ClassLoader loader = Thread.currentThread().getContextClassLoader(); String cls = vendor.getVirtualMachineClassName(); if (vendor.isIBM() == false) { loader = new URLClassLoader(new URL[] { toolsJar.toURI().toURL() }, loader); } return loader.loadClass(cls); } catch (Exception e) { if (log.isTraceEnabled()) { log.trace(_name + ".loadVMClass() failed to load the VirtualMachine class"); } } return null; }
/** * If <b>ibm</b> is false, this private method will create a new URLClassLoader and attempt to load the * com.sun.tools.attach.VirtualMachine class from the provided toolsJar file. * * <p> * If <b>ibm</b> is true, this private method will ignore the toolsJar parameter and load the * com.ibm.tools.attach.VirtualMachine class. * * * @return The AttachAPI VirtualMachine class <br> * or null if something unexpected happened. */ private static Class<?> loadVMClass(File toolsJar, Log log, JavaVendors vendor) { try { ClassLoader loader = Thread.currentThread().getContextClassLoader(); String cls = vendor.getVirtualMachineClassName(); if (vendor.isIBM() == false) { loader = new URLClassLoader(new URL[] { toolsJar.toURI().toURL() }, loader); } return loader.loadClass(cls); } catch (Exception e) { if (log.isTraceEnabled()) { log.trace(_name + ".loadVMClass() failed to load the VirtualMachine class"); } } return null; }
/** * If <b>ibm</b> is false, this private method will create a new URLClassLoader and attempt to load the * com.sun.tools.attach.VirtualMachine class from the provided toolsJar file. * * <p> * If <b>ibm</b> is true, this private method will ignore the toolsJar parameter and load the * com.ibm.tools.attach.VirtualMachine class. * * * @return The AttachAPI VirtualMachine class <br> * or null if something unexpected happened. */ private static Class<?> loadVMClass(File toolsJar, Log log, JavaVendors vendor) { try { ClassLoader loader = Thread.currentThread().getContextClassLoader(); String cls = vendor.getVirtualMachineClassName(); if (vendor.isIBM() == false) { loader = new URLClassLoader(new URL[] { toolsJar.toURI().toURL() }, loader); } return loader.loadClass(cls); } catch (Exception e) { if (log.isTraceEnabled()) { log.trace(_name + ".loadVMClass() failed to load the VirtualMachine class"); } } return null; }
/** * If <b>ibm</b> is false, this private method will create a new URLClassLoader and attempt to load the * com.sun.tools.attach.VirtualMachine class from the provided toolsJar file. * * <p> * If <b>ibm</b> is true, this private method will ignore the toolsJar parameter and load the * com.ibm.tools.attach.VirtualMachine class. * * * @return The AttachAPI VirtualMachine class <br> * or null if something unexpected happened. */ private static Class<?> loadVMClass(File toolsJar, Log log, JavaVendors vendor) { try { ClassLoader loader = Thread.currentThread().getContextClassLoader(); String cls = vendor.getVirtualMachineClassName(); if (vendor.isIBM() == false) { loader = new URLClassLoader(new URL[] { toolsJar.toURI().toURL() }, loader); } return loader.loadClass(cls); } catch (Exception e) { if (log.isTraceEnabled()) { log.trace(_name + ".loadVMClass() failed to load the VirtualMachine class"); } } return null; }