On Friday, March 20, 2020 at 3:58:40 PM UTC+1, fschulte.de.w...@gmail.com wrote: > > Dear Evgeny,, > > this is working and I get coverage data, thanks! > > Now I need a hint on re-deploy of my instrumented war file. In either case > jmx or tcpserver the resource is still bound and fails the deploy because > of this. > > How can I instruct jacoco to execute the "shutdown()" method for jmx or > tcpserver output mode? > > Or is there any other way? A Java Listener that reacts on undeploy to call > this shutdown() method? > > Today I need to restart the complete j2ee server to accomplish a second > deploy. >
Such "shutdown" method is not exposed as JaCoCo API as you can see in the documentation at https://www.jacoco.org/jacoco/trunk/doc/api/index.html However using reflection in implementation of your listener you can do the following: Object agent = org.jacoco.agent.rt.RT.getAgent(); Method shutdownMethod = agent.getClass().getDeclaredMethod("shutdown"); shutdownMethod.invoke(agent); But I'm not sure that this will be enough, because JaCoCo also registers JVM shutdown hook. You can try the following modification https://github.com/jacoco/jacoco/compare/master...Godin:experiment_with_disabled_shutdown_hook Using the following unofficial build https://dev.azure.com/mandrikov/JaCoCo/_build/results?buildId=248&view=artifacts&type=publishedArtifacts Regards, Evgeny -- You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/2666f38d-74d0-499b-a731-1f087d95cf2d%40googlegroups.com.