To start the service, I know one uses new MyService().run(args). How to stop it?
I need to start and stop programmatically for setUp() and
Or you use this java feature in your main/constructor ...:
// In case jvm shutdown
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run()
{
// what should be closed if forced shudown
// ....
LOG.info(String.format("--- End of ShutDownHook (%s) ---", APPLICATION_NAME));
}
});