@Test public void stopBeforeStartDisallowed() throws Exception { LifecycleSupport underTest = new LifecycleSupport(); assertState(underTest, State.NEW); try { underTest.stop(); } catch (IllegalStateException e) { } assertState(underTest, State.NEW); }
@Override public final void stop() throws Exception { ensure(State.STARTED); Locks.lock(lock); try { ensure(State.STARTED); try { logTransition("Stopping"); doStop(); current = State.STOPPED; logTransition("Stopped"); } catch (Throwable failure) { doFailed("stop", failure); } } finally { lock.unlock(); } }
LifecycleSupport extends ComponentSupport implements Lifecycle { @Override public final void stop() throws Exception { ensure(State.STARTED); Locks.lock(lock); try { ensure(State.STARTED); try { logTransition("Stopping"); doStop(); current = State.STOPPED; logTransition("Stopped"); } catch (Throwable failure) { doFailed("stop", failure); } } finally { lock.unlock(); } } }
LifecycleSupport extends ComponentSupport implements Lifecycle { @Override public final void stop() throws Exception { ensure(State.STARTED); Locks.lock(lock); try { ensure(State.STARTED); try { logTransition("Stopping"); doStop(); current = State.STOPPED; logTransition("Stopped"); } catch (Throwable failure) { doFailed("stop", failure); } } finally { lock.unlock(); } }  }
LifecycleSupport extends ComponentSupport implements Lifecycle { @Override public final void stop() throws Exception { ensure(State.STARTED); Locks.lock(lock); try { ensure(State.STARTED); try { logTransition("Stopping"); doStop(); current = State.STOPPED; logTransition("Stopped"); } catch (Throwable failure) { doFailed("stop", failure); } } finally { lock.unlock(); } }  @Override final void start(); @Override final void stop(); }
LifecycleSupport extends ComponentSupport implements Lifecycle { @Override public final void stop() throws Exception { ensure(State.STARTED); Locks.lock(lock); try { ensure(State.STARTED); try { logTransition("Stopping"); doStop(); current = State.STOPPED; logTransition("Stopped"); } catch (Throwable failure) { doFailed("stop", failure); } } finally { lock.unlock(); } }  @Override final void start(); @Override final void stop();  }