Package org.apache.twill.common

Examples of org.apache.twill.common.ServiceListenerAdapter


    TwillController controller = runner.prepare(new SleepRunnable(600))
                                       .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
                                       .start();

    final CountDownLatch runLatch = new CountDownLatch(1);
    controller.addListener(new ServiceListenerAdapter() {
      @Override
      public void running() {
        runLatch.countDown();
      }
    }, Threads.SAME_THREAD_EXECUTOR);
View Full Code Here


    TwillController controller = runner.prepare(new DummyApplication())
                                       .enableDebugging("r1")
                                       .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out)))
                                       .start();
    final CountDownLatch running = new CountDownLatch(1);
    controller.addListener(new ServiceListenerAdapter() {
      @Override
      public void running() {
        running.countDown();
      }
    }, Threads.SAME_THREAD_EXECUTOR);
View Full Code Here

    TwillController controller = runner.prepare(new DummyApplication())
                                       .enableDebugging()
                                       .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out)))
                                       .start();
    final CountDownLatch running = new CountDownLatch(1);
    controller.addListener(new ServiceListenerAdapter() {
      @Override
      public void running() {
        running.countDown();
      }
    }, Threads.SAME_THREAD_EXECUTOR);
View Full Code Here

                                        .withApplicationArguments("echo")
                                        .withArguments("EchoServer", "echo2")
                                        .start();

    final CountDownLatch running = new CountDownLatch(1);
    controller.addListener(new ServiceListenerAdapter() {
      @Override
      public void running() {
        running.countDown();
      }
    }, Threads.SAME_THREAD_EXECUTOR);
View Full Code Here

      }
    };
  }

  private YarnTwillController listenController(final YarnTwillController controller) {
    controller.addListener(new ServiceListenerAdapter() {
      @Override
      public void terminated(State from) {
        removeController();
      }
View Full Code Here

    httpService = NettyHttpService.builder()
      .addHttpHandlers(ImmutableList.of(new ForwardingHandler(clientService)))
      .setHost("0.0.0.0")
      .setPort(httpPort)
      .build();
    httpService.addListener(new ServiceListenerAdapter() {
      private Cancellable cancellable;

      @Override
      public void running() {
        final InetSocketAddress socketAddress = httpService.getBindAddress();
View Full Code Here

    } else {
      LOG.info("Starting {} application", serviceName);
      TwillPreparer twillPreparer = getPreparer();
      twillController = twillPreparer.start();

      twillController.addListener(new ServiceListenerAdapter() {
        @Override
        public void failed(Service.State from, Throwable failure) {
          LOG.error("{} failed with exception... restarting with back-off.", serviceName, failure);
          backOffRun();
        }
View Full Code Here

    LOG.info("Runnable stopped {}", name);
  }

  private Service.Listener createServiceListener(final SettableFuture<Service.State> completion) {
    return new ServiceListenerAdapter() {
      @Override
      public void terminated(Service.State from) {
        completion.set(from);
      }
View Full Code Here

                             "Cannot change instance count of a flowlet without suspension.");
    flowletContext.setInstanceCount(instanceCount);
  }

  private void listenDriveState(FlowletProcessDriver driver) {
    driver.addListener(new ServiceListenerAdapter() {
      @Override
      public void running() {
        started();
      }
View Full Code Here

    LOG.info("Runnable stopped {}", name);
  }

  private Service.Listener createServiceListener(final SettableFuture<Service.State> completion) {
    return new ServiceListenerAdapter() {
      @Override
      public void terminated(Service.State from) {
        completion.set(from);
      }
View Full Code Here

TOP

Related Classes of org.apache.twill.common.ServiceListenerAdapter

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.