stmt; stmt; stmt; stmt; stmt; } java.lang.RuntimeException: blah! at org.springframework.samples.petclinic.validation.OwnerValidator.doSomething(OwnerValidator.java:41) at org.springframework.samples.petclinic.web.AddOwnerForm.processSubmit(AddOwnerForm.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560) at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) Tuesday, September 24, 13
• Instrumentation parameter is optional • META-INF/MANIFEST.MF is required • Requires support for loading agents in JVM • Allows adding the code to JVM post-factum public static void agentmain(String args, Instrumentation inst) Tuesday, September 24, 13
//get system properties in the target VM Properties props = vm.getSystemProperties(); //load agent into the VM vm.loadAgent("agent.jar", "arg1=x,arg2=y"); //detach from VM vm.detach(); http://docs.oracle.com/javase/7/docs/jdk/api/attach/spec/com/sun/tools/attach/VirtualMachine.html Tuesday, September 24, 13
Java classes in a running JVM process • Integrates with Java ecosystem • Java application servers / containers • Java application frameworks • Reloads configurations and meta-data • IDE plugins Tuesday, September 24, 13
tooling • JRebel can reload classes and framework configurations on the fly • Plumbr detects memory leaks and researches performance problems Tuesday, September 24, 13