Package jersey.repackaged.com.google.common.util.concurrent.Service

Examples of jersey.repackaged.com.google.common.util.concurrent.Service.State


   *     method is called, {@link State#TERMINATED terminated} or {@link State#FAILED failed}.
   */
  public ServiceManager startAsync() {
    for (Map.Entry<Service, ServiceListener> entry : services.entrySet()) {
      Service service = entry.getKey();
      State state = service.state();
      checkState(state == State.NEW, "Service %s is %s, cannot start it.", service,
          state);
    }
    for (ServiceListener service : services.values()) {
      service.start();
View Full Code Here


   *     ordered by startup time.
   */
  public ImmutableMap<Service, Long> startupTimes() {
    Map<Service, Long> loadTimeMap = Maps.newHashMapWithExpectedSize(services.size());
    for (Map.Entry<Service, ServiceListener> entry : services.entrySet()) {
      State state = entry.getKey().state();
      if (state != State.NEW && state != State.STARTING) {
        loadTimeMap.put(entry.getKey(), entry.getValue().startupTimeMillis());
      }
    }
    List<Entry<Service, Long>> servicesByStartTime = Ordering.<Long>natural()
View Full Code Here

        IllegalStateException failure = new IllegalStateException(
            "Cannot notifyStopped() when the service is " + snapshot.state);
        notifyFailed(failure);
        throw failure;
      }
      State previous = snapshot.state;
      snapshot = new StateSnapshot(State.TERMINATED);
      terminated(previous);
    } finally {
      lock.unlock();
      executeListeners();
View Full Code Here

        case TERMINATED:
          throw new IllegalStateException("Failed while in state:" + snapshot.state, cause);
        case RUNNING:
        case STARTING:
        case STOPPING:
          State previous = snapshot.state;
          snapshot = new StateSnapshot(State.FAILED, false, cause);
          failed(previous, cause);
          break;
        case FAILED:
          // Do nothing
View Full Code Here

TOP

Related Classes of jersey.repackaged.com.google.common.util.concurrent.Service.State

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.