Home | History | Annotate | Download | only in concurrent

Lines Matching refs:State

22 import com.google.common.base.Service.State; // javadoc needs this
50 * The internal state, which equals external state unless
53 private State state = State.NEW;
86 public final Future<State> start() {
89 if (state == State.NEW) {
90 state = State.STARTING;
103 public final Future<State> stop() {
106 if (state == State.NEW) {
107 state = State.TERMINATED;
108 startup.transitionSucceeded(State.TERMINATED);
109 shutdown.transitionSucceeded(State.TERMINATED);
110 } else if (state == State.STARTING) {
112 startup.transitionSucceeded(State.STOPPING);
113 } else if (state == State.RUNNING) {
114 state = State.STOPPING;
127 public State startAndWait() {
138 public State stopAndWait() {
152 * State#STARTING} to {@link State#RUNNING}.
155 * {@link State#STARTING}.
160 if (state != State.STARTING) {
162 "Cannot notifyStarted() when the service is " + state);
167 state = State.RUNNING;
171 startup.transitionSucceeded(State.RUNNING);
181 * State#STOPPING} to {@link State#TERMINATED}.
184 * State#STOPPING} nor {@link State#RUNNING}.
189 if (state != State.STOPPING && state != State.RUNNING) {
191 "Cannot notifyStopped() when the service is " + state);
196 state = State.TERMINATED;
197 shutdown.transitionSucceeded(State.TERMINATED);
205 * {@link State#FAILED}. The service will <b>not be stopped</b> if it
214 if (state == State.STARTING) {
218 } else if (state == State.STOPPING) {
222 state = State.FAILED;
229 return state() == State.RUNNING;
232 public final State state() {
235 if (shutdownWhenStartupFinishes && state == State.STARTING) {
236 return State.STOPPING;
238 return state;
246 * A change from one service state to another, plus the result of the change.
251 private static class Transition implements Future<State> {
253 private State result;
256 void transitionSucceeded(State result) {
266 this.result = State.FAILED;
283 public State get() throws InterruptedException, ExecutionException {
288 public State get(long timeout, TimeUnit unit)
296 private State getImmediately() throws ExecutionException {
297 if (result == State.FAILED) {