How should I stop the forked VM?

Behrooz Nobakht nobeh5 at gmail.com
Fri Jan 9 20:24:20 UTC 2015


Hi Dmitry,

Thanks for your reply. That's exactly what I already did. I stop the
embedded server setup (Jetty/Jetty) in @TearDown fixture method. However, I
did not know the second which there's no guarantee that the same thread
would be used to shut down the forked VM. I'd appreciate any further ideas.

Thanks,
Behrooz


On Fri, Jan 9, 2015 at 6:18 PM, <vyazelenko at yahoo.com> wrote:

> 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
>



-- 
-- Behrooz Nobakht


More information about the jmh-dev mailing list