com.sun.tools.attach.AgentInitializationException Java Examples
The following examples show how to use
com.sun.tools.attach.AgentInitializationException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HotSpotVirtualMachine.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private void loadAgentLibrary(String agentLibrary, boolean isAbsolute, String options) throws AgentLoadException, AgentInitializationException, IOException { InputStream in = execute("load", agentLibrary, isAbsolute ? "true" : "false", options); try { int result = readInt(in); if (result != 0) { throw new AgentInitializationException("Agent_OnAttach failed", result); } } finally { in.close(); } }
Example #2
Source File: HotSpotVirtualMachine.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private void loadAgentLibrary(String agentLibrary, boolean isAbsolute, String options) throws AgentLoadException, AgentInitializationException, IOException { InputStream in = execute("load", agentLibrary, isAbsolute ? "true" : "false", options); try { int result = readInt(in); if (result != 0) { throw new AgentInitializationException("Agent_OnAttach failed", result); } } finally { in.close(); } }
Example #3
Source File: HotSpotVirtualMachine.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private void loadAgentLibrary(String agentLibrary, boolean isAbsolute, String options) throws AgentLoadException, AgentInitializationException, IOException { InputStream in = execute("load", agentLibrary, isAbsolute ? "true" : "false", options); try { int result = readInt(in); if (result != 0) { throw new AgentInitializationException("Agent_OnAttach failed", result); } } finally { in.close(); } }
Example #4
Source File: HotSpotVirtualMachine.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private void loadAgentLibrary(String agentLibrary, boolean isAbsolute, String options) throws AgentLoadException, AgentInitializationException, IOException { InputStream in = execute("load", agentLibrary, isAbsolute ? "true" : "false", options); try { int result = readInt(in); if (result != 0) { throw new AgentInitializationException("Agent_OnAttach failed", result); } } finally { in.close(); } }
Example #5
Source File: HotSpotVirtualMachine.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private void loadAgentLibrary(String agentLibrary, boolean isAbsolute, String options) throws AgentLoadException, AgentInitializationException, IOException { InputStream in = execute("load", agentLibrary, isAbsolute ? "true" : "false", options); try { int result = readInt(in); if (result != 0) { throw new AgentInitializationException("Agent_OnAttach failed", result); } } finally { in.close(); } }
Example #6
Source File: HotSpotVirtualMachine.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
private void loadAgentLibrary(String agentLibrary, boolean isAbsolute, String options) throws AgentLoadException, AgentInitializationException, IOException { InputStream in = execute("load", agentLibrary, isAbsolute ? "true" : "false", options); try { int result = readInt(in); if (result != 0) { throw new AgentInitializationException("Agent_OnAttach failed", result); } } finally { in.close(); } }
Example #7
Source File: HotSpotVirtualMachine.java From hottub with GNU General Public License v2.0 | 6 votes |
private void loadAgentLibrary(String agentLibrary, boolean isAbsolute, String options) throws AgentLoadException, AgentInitializationException, IOException { InputStream in = execute("load", agentLibrary, isAbsolute ? "true" : "false", options); try { int result = readInt(in); if (result != 0) { throw new AgentInitializationException("Agent_OnAttach failed", result); } } finally { in.close(); } }
Example #8
Source File: HotSpotVirtualMachine.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private void loadAgentLibrary(String agentLibrary, boolean isAbsolute, String options) throws AgentLoadException, AgentInitializationException, IOException { InputStream in = execute("load", agentLibrary, isAbsolute ? "true" : "false", options); try { int result = readInt(in); if (result != 0) { throw new AgentInitializationException("Agent_OnAttach failed", result); } } finally { in.close(); } }
Example #9
Source File: HotSpotVirtualMachine.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private void loadAgentLibrary(String agentLibrary, boolean isAbsolute, String options) throws AgentLoadException, AgentInitializationException, IOException { InputStream in = execute("load", agentLibrary, isAbsolute ? "true" : "false", options); try { int result = readInt(in); if (result != 0) { throw new AgentInitializationException("Agent_OnAttach failed", result); } } finally { in.close(); } }
Example #10
Source File: HotSpotVirtualMachine.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private void loadAgentLibrary(String agentLibrary, boolean isAbsolute, String options) throws AgentLoadException, AgentInitializationException, IOException { InputStream in = execute("load", agentLibrary, isAbsolute ? "true" : "false", options); try { int result = readInt(in); if (result != 0) { throw new AgentInitializationException("Agent_OnAttach failed", result); } } finally { in.close(); } }
Example #11
Source File: HotSpotVirtualMachine.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private void loadAgentLibrary(String agentLibrary, boolean isAbsolute, String options) throws AgentLoadException, AgentInitializationException, IOException { InputStream in = execute("load", agentLibrary, isAbsolute ? "true" : "false", options); try { int result = readInt(in); if (result != 0) { throw new AgentInitializationException("Agent_OnAttach failed", result); } } finally { in.close(); } }
Example #12
Source File: TestJDWPAgentDebug.java From tracing-framework with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Test public void testBadModification2() throws ClassNotFoundException, AgentLoadException, AgentInitializationException, IOException, AttachNotSupportedException, UnmodifiableClassException, IllegalConnectorArgumentsException { // Rewrite method DynamicModification badModification = new DynamicModification() { public Collection<String> affects() { return Lists.newArrayList(TestJDWPAgentDebug.class.getName()); } public void apply(ClassPool arg0) throws NotFoundException, CannotCompileException { CtClass cls = arg0.getCtClass(TestJDWPAgentDebug.class.getName()); cls.getMethods()[0].insertBefore("definitely not code..."); } }; JDWPAgent dynamic = JDWPAgent.get(); // Modification should just be ignored since it throws a notfoundexception try { dynamic.install(badModification); fail(); } catch (CannotCompileException e) { } }
Example #13
Source File: HotSpotVirtualMachine.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private void loadAgentLibrary(String agentLibrary, boolean isAbsolute, String options) throws AgentLoadException, AgentInitializationException, IOException { InputStream in = execute("load", agentLibrary, isAbsolute ? "true" : "false", options); try { int result = readInt(in); if (result != 0) { throw new AgentInitializationException("Agent_OnAttach failed", result); } } finally { in.close(); } }
Example #14
Source File: TestJVMAgent.java From tracing-framework with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Test public void testBadModification2() throws ClassNotFoundException, AgentLoadException, AgentInitializationException, IOException, AttachNotSupportedException, UnmodifiableClassException { // Rewrite method DynamicModification badModification = new DynamicModification() { public Collection<String> affects() { return Lists.newArrayList(TestJVMAgent.class.getName()); } public void apply(ClassPool arg0) throws NotFoundException, CannotCompileException { CtClass cls = arg0.getCtClass(TestJVMAgent.class.getName()); cls.getMethods()[0].insertBefore("definitely not code..."); } }; JVMAgent dynamic = JVMAgent.get(); // Modification should just be ignored since it throws a notfoundexception try { dynamic.install(badModification); fail(); } catch (CannotCompileException e) { } }
Example #15
Source File: TestJavaInfo.java From Jpom with MIT License | 5 votes |
public static void main(String[] args) throws IOException, AttachNotSupportedException, AgentLoadException, AgentInitializationException, ClassNotFoundException { System.out.println(SystemUtil.getJavaRuntimeInfo().getHomeDir()); // VirtualMachine virtualMachine = VirtualMachine.attach("16772"); // String agent = StrUtil.format("{}{}lib{}management-agent.jar", SystemUtil.getJavaRuntimeInfo().getHomeDir(), File.separator, File.separator); // virtualMachine.loadAgent(agent); // virtualMachine.loadAgent(agent); JvmUtil.importFrom(7292); System.out.println(JvmUtil.importFrom(7292)); }
Example #16
Source File: HotSpotVirtualMachine.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void loadAgent(String agent, String options) throws AgentLoadException, AgentInitializationException, IOException { String args = agent; if (options != null) { args = args + "=" + options; } try { loadAgentLibrary("instrument", args); } catch (AgentInitializationException x) { /* * Translate interesting errors into the right exception and * message (FIXME: create a better interface to the instrument * implementation so this isn't necessary) */ int rc = x.returnValue(); switch (rc) { case JNI_ENOMEM: throw new AgentLoadException("Insuffient memory"); case ATTACH_ERROR_BADJAR: throw new AgentLoadException( "Agent JAR not found or no Agent-Class attribute"); case ATTACH_ERROR_NOTONCP: throw new AgentLoadException( "Unable to add JAR file to system class path"); case ATTACH_ERROR_STARTFAIL: throw new AgentInitializationException( "Agent JAR loaded but agent failed to initialize"); default : throw new AgentLoadException("" + "Failed to load agent - unknown reason: " + rc); } } }
Example #17
Source File: AgentMainTest.java From fastjgame with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws IOException, AttachNotSupportedException, AgentLoadException, AgentInitializationException { String pid = getPid(); VirtualMachine vm = VirtualMachine.attach(pid); vm.loadAgent("game-classreloadagent-1.0.jar"); System.out.println(ClassReloadAgent.isRedefineClassesSupported()); System.out.println(ClassReloadAgent.isModifiableClass(AgentMainTest.class)); }
Example #18
Source File: TestJVMAgent.java From tracing-framework with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void testBadModification() throws ClassNotFoundException, AgentLoadException, AgentInitializationException, IOException, AttachNotSupportedException, UnmodifiableClassException, CannotCompileException { // Rewrite method DynamicModification badModification = new DynamicModification() { public Collection<String> affects() { return Lists.newArrayList(TestJVMAgent.class.getName()); } public void apply(ClassPool arg0) throws NotFoundException, CannotCompileException { arg0.getCtClass("edu.brown.cs.systems.pivottracing.dynamicinstrumentation.NotaRealClass"); } }; JVMAgent dynamic = JVMAgent.get(); // Modification should just be ignored since it throws a notfoundexception dynamic.install(badModification); }
Example #19
Source File: HotSpotVirtualMachine.java From Carbon with GNU Lesser General Public License v3.0 | 5 votes |
private void loadAgentLibrary(String agentLibrary, boolean isAbsolute, String options) throws AgentLoadException, AgentInitializationException, IOException { InputStream in = execute("load", agentLibrary, isAbsolute ? "true" : "false", options); try { int result = readInt(in); if (result != 0) { throw new AgentInitializationException("Agent_OnAttach failed", result); } } finally { in.close(); } }
Example #20
Source File: HotSpotVirtualMachine.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public void loadAgentLibrary(String agentLibrary, String options) throws AgentLoadException, AgentInitializationException, IOException { loadAgentLibrary(agentLibrary, false, options); }
Example #21
Source File: SimpleProvider.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public void loadAgentPath(String agentLibrary, String options) throws IOException, AgentLoadException, AgentInitializationException { }
Example #22
Source File: SimpleProvider.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void loadAgentPath(String agentLibrary, String options) throws IOException, AgentLoadException, AgentInitializationException { }
Example #23
Source File: SimpleProvider.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public void loadAgentLibrary(String agentLibrary, String options) throws IOException, AgentLoadException, AgentInitializationException { }
Example #24
Source File: SimpleProvider.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void loadAgentLibrary(String agentLibrary, String options) throws IOException, AgentLoadException, AgentInitializationException { }
Example #25
Source File: HotSpotVirtualMachine.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void loadAgentPath(String agentLibrary, String options) throws AgentLoadException, AgentInitializationException, IOException { loadAgentLibrary(agentLibrary, true, options); }
Example #26
Source File: HotSpotVirtualMachine.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void loadAgentLibrary(String agentLibrary, String options) throws AgentLoadException, AgentInitializationException, IOException { loadAgentLibrary(agentLibrary, false, options); }
Example #27
Source File: HotSpotVirtualMachine.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public void loadAgentPath(String agentLibrary, String options) throws AgentLoadException, AgentInitializationException, IOException { loadAgentLibrary(agentLibrary, true, options); }
Example #28
Source File: SimpleProvider.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public void loadAgentLibrary(String agentLibrary, String options) throws IOException, AgentLoadException, AgentInitializationException { }
Example #29
Source File: HotSpotVirtualMachine.java From hottub with GNU General Public License v2.0 | 4 votes |
public void loadAgentLibrary(String agentLibrary, String options) throws AgentLoadException, AgentInitializationException, IOException { loadAgentLibrary(agentLibrary, false, options); }
Example #30
Source File: HotSpotVirtualMachine.java From hottub with GNU General Public License v2.0 | 4 votes |
public void loadAgentPath(String agentLibrary, String options) throws AgentLoadException, AgentInitializationException, IOException { loadAgentLibrary(agentLibrary, true, options); }