@Override public void start(Collection<? extends Location> locs) { getConfig(LISTENER).onEvent(this, "start", new Object[] {locs}); if (getConfig(FAIL_ON_START) || (getConfig(FAIL_ON_START_CONDITION) != null && getConfig(FAIL_ON_START_CONDITION).apply(this))) { if (Boolean.TRUE.equals(getConfig(SET_SERVICE_DOWN_ON_FAILURE))) { ServiceStateLogic.setExpectedState(this, Lifecycle.STARTING); sensors().set(SERVICE_UP, false); ServiceStateLogic.setExpectedStateRunningWithErrors(this); } callHistory.add("start"); getConfig(EXEC_ON_FAILURE).apply(this); throw fail("Simulating entity start failure for test"); } super.start(locs); }
@Override public void restart() { getConfig(LISTENER).onEvent(this, "restart", new Object[0]); if (getConfig(FAIL_ON_RESTART) || (getConfig(FAIL_ON_RESTART_CONDITION) != null && getConfig(FAIL_ON_RESTART_CONDITION).apply(this))) { if (Boolean.TRUE.equals(getConfig(SET_SERVICE_DOWN_ON_FAILURE))) { ServiceStateLogic.setExpectedState(this, Lifecycle.STOPPING); sensors().set(SERVICE_UP, false); ServiceStateLogic.setExpectedState(this, Lifecycle.STOPPED); ServiceStateLogic.setExpectedState(this, Lifecycle.STARTING); ServiceStateLogic.setExpectedStateRunningWithErrors(this); } callHistory.add("restart"); getConfig(EXEC_ON_FAILURE).apply(this); throw fail("Simulating entity restart failure for test"); } super.restart(); }
ServiceStateLogic.setExpectedStateRunningWithErrors(this);
ServiceStateLogic.setExpectedStateRunningWithErrors(this);
} catch (Exception e) { ServiceProblemsLogic.updateProblemsIndicator(this, START, "start failed with error: "+e); ServiceStateLogic.setExpectedStateRunningWithErrors(this); throw Exceptions.propagate(e);