Package com.google.common.util.concurrent

Examples of com.google.common.util.concurrent.ServiceManager$SynchronizedExecutor


        // register node by initiating first ping. if the node isn't registered, loading persisted inputs will fail silently, for example
        Ping.Pinger pinger = injector.getInstance(Ping.Pinger.class);
        pinger.ping();

        final ServiceManager serviceManager = injector.getInstance(ServiceManager.class);
        final ServiceManagerListener serviceManagerListener = injector.getInstance(ServiceManagerListener.class);
        serviceManager.addListener(serviceManagerListener);
        serviceManager.startAsync().awaitHealthy();

        LOG.info("Graylog2 Radio up and running.");

        while (true) {
            try { Thread.sleep(1000); } catch (InterruptedException e) { /* lol, i don't care */ }
View Full Code Here


    Set<Service> services;

    @Override
    public ServiceManager get() {
        LOG.debug("Using services: {}", services);
        return new ServiceManager(services);
    }
View Full Code Here

        // Le server object. This is where all the magic happens.
        final ServerStatus serverStatus = injector.getInstance(ServerStatus.class);
        serverStatus.initialize();

        ActivityWriter activityWriter = null;
        ServiceManager serviceManager = null;
        try {
            activityWriter = injector.getInstance(ActivityWriter.class);
            serviceManager = injector.getInstance(ServiceManager.class);
        } catch (ProvisionException e) {
            for (Message message : e.getErrorMessages()) {
                if (message.getCause() instanceof MongoException) {
                    LOG.error(UI.wallString("Unable to connect to MongoDB. Is it running and the configuration correct?"));
                    System.exit(-1);
                }
            }

            LOG.error("Guice error", e);
            System.exit(-1);
        } catch (Exception e) {
            LOG.error("Unexpected exception", e);
            System.exit(-1);
        }

        final ActivityWriter finalActivityWriter = activityWriter;
        final ServiceManager finalServiceManager = serviceManager;
        Runtime.getRuntime().addShutdownHook(new Thread() {
            @Override
            public void run() {
                String msg = "SIGNAL received. Shutting down.";
                LOG.info(msg);
                finalActivityWriter.write(new Activity(msg, Main.class));

                GracefulShutdown shutdown = injector.getInstance(GracefulShutdown.class);
                shutdown.runWithoutExit();
                finalServiceManager.stopAsync().awaitStopped();
            }
        });

        // Register this node.
        final NodeService nodeService = injector.getInstance(NodeService.class);
View Full Code Here

          stdout.printf("  %s = %s%n", entry.getKey(), entry.getValue());
        }
      }
      // check that the parameters are valid
      injector.getInstance(BenchmarkClass.class).validateParameters(options.userParameters());
      ServiceManager serviceManager = injector.getInstance(ServiceManager.class);
      serviceManager.startAsync().awaitHealthy();
      try {
        CaliperRun run = injector.getInstance(CaliperRun.class); // throws wrapped ICE, IBE
        run.run(); // throws IBE
      } finally {
        serviceManager.stopAsync();
      }
    } catch (CreationException e) {
      propogateIfCaliperException(e.getCause());
      throw e;
    } catch (ProvisionException e) {
View Full Code Here

  }

  @Provides
  @Singleton
  ServiceManager provideServiceManager(Set<Service> services) {
    return new ServiceManager(services);
  }
View Full Code Here

      if( args.length > 1) {
        Logging.setup(host, commandLineArguments.getLogPort());
      }

      List<StageService> stageServices = StageServiceFactory.createStageServices(stageName, host, port, performanceLogging, stage);
      startServices(new ServiceManager(stageServices));
    } catch(Exception e) {
      logger.error("Caught exception while starting stage(s).", e);
      System.exit(1);
    }
  }
View Full Code Here

    } catch (Exception e) {
      logger.error("Unable to connect to remote logging host on "+ host +":"+cmdLineArgs.getLogPort(), e);
      System.exit(1);
    }

    final ServiceManager manager;
    try {
      manager = getServiceManager(groupName, host, port, performanceLogging);
    } catch (Exception e) {
      logger.error("Failed to get stage service manager. Shutting down.", e);
      System.exit(1);
View Full Code Here

    List<StageService> stageServices = new ArrayList<StageService>();
    for (String stageName : getStages(host, port, groupName)) {
      List<StageService> stageServicesForStage = StageServiceFactory.createStageServices(stageName, host, port, performanceLogging, null);
      stageServices.addAll(stageServicesForStage);
    }
    return new ServiceManager(stageServices);
  }
View Full Code Here

  @Provides
  @Singleton
  @SchedulerActive
  ServiceManagerIface provideSchedulerActiveServiceManager(@SchedulerActive Set<Service> services) {
    return GuavaUtils.serviceManager(new ServiceManager(services));
  }
View Full Code Here

TOP

Related Classes of com.google.common.util.concurrent.ServiceManager$SynchronizedExecutor

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.