How should I stop the forked VM?

vyazelenko at yahoo.com vyazelenko at yahoo.com
Fri Jan 9 17:18:46 UTC 2015


Hi Behrooz,

You can use @Setup/@TearDown pair, i.e. start Jetty in setup and kill it in teardown. However keep in mind that JMH does not guarantee that the same thread that executed @Setup will execute @TearDown when multiple threads are used.

Best regards,
Dmitry

Sent from my iPhone

> On Jan 9, 2015, at 17:05, Behrooz Nobakht <nobeh5 at gmail.com> wrote:
> 
> Hi,
> 
> I am running JMH in a setup in which I bring up embedded Jetty/Jersey
> applications in one thread in the forked VM and add shutdown hooks for the
> forked VM. Now, when I run JMH benchmars:
> 
> - using fork = 1, when the benchmark is done, nothing happens (result
> output) and it seems to waiting for some of the threads in the forked VM to
> finished. I even tried to explicitly shutdown threads including
> Jetty/Jersey.
> - using fork = 0, JMH reaches to the point to print the results, but it
> still it never finishes.
> 
> My hunch is that I have a bunch of ExectuorService instances on the forked
> VM but I do not have explicit control over shutting them down. How should I
> fix this issue?
> 
> Thanks,
> Behrooz


More information about the jmh-dev mailing list