StatusWaiter waiter = null;
if (action.equalsIgnoreCase("start")) {
waiter = rm.start(r, wait);
} else if (action.equalsIgnoreCase("stop")) {
waiter = rm.stop(r, wait);
} else if (action.equalsIgnoreCase("restart")) {
// stop the runner and wait for it to stop
waiter = rm.stop(r, true);
if (waiter != null) {
waiter.waitFor();