@Override public boolean isStarted() { return super.isStarted(); }
/** * @since 2.1 */ protected boolean isFailed() { return is(State.FAILED); } }
@Override public final void stop() throws Exception { Lock lock = Locks.write(readWriteLock); ensure(State.STARTED); try { logTransition("Stopping"); doStop(); current = State.STOPPED; logTransition("Stopped"); } catch (Throwable failure) { doFailed("stop", failure); } finally { lock.unlock(); } }
@Override public final void start() throws Exception { Lock lock = Locks.write(readWriteLock); ensure(State.NEW, State.STOPPED); try { logTransition("Starting"); doStart(); current = State.STARTED; logTransition("Started"); } catch (Throwable failure) { doFailed("start", failure); } finally { lock.unlock(); } }
protected void ensureStopped() { checkState(isStopped(), "Not stopped"); }
protected void doFailed(final String operation, final Throwable cause) throws Exception { logTransitionFailure("Lifecycle operation " + operation + " failed", cause); current = State.FAILED; Throwables.propagateIfPossible(cause, Exception.class); throw Throwables.propagate(cause); }
@Override public boolean isStarted() { return super.isStarted(); }
protected boolean isStarted() { return is(State.STARTED); }
protected void ensureStarted() { checkState(isStarted(), "Not started"); }
protected boolean isStopped() { return is(State.STOPPED); }