Package org.apache.twill.common

Examples of org.apache.twill.common.ServiceListenerAdapter


      Service service = createService(zkClientService, runId);
      service.startAndWait();

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


    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

      }
    };
  }

  private YarnTwillController listenController(final YarnTwillController controller) {
    controller.addListener(new ServiceListenerAdapter() {
      @Override
      public void terminated(State from) {
        removeController();
      }
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

                                            .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
                                            .start();

    final CountDownLatch runLatch = new CountDownLatch(1);
    final CountDownLatch stopLatch = new CountDownLatch(1);
    controller.addListener(new ServiceListenerAdapter() {

      @Override
      public void running() {
        runLatch.countDown();
      }
View Full Code Here

    TwillController controller = twillRunner.prepare(new DistributedShell("pwd", "ls -al"))
                                            .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out)))
                                            .start();

    final CountDownLatch stopLatch = new CountDownLatch(1);
    controller.addListener(new ServiceListenerAdapter() {

      @Override
      public void terminated(Service.State from) {
        stopLatch.countDown();
      }
View Full Code Here

    decoratedService.stop();
    callbackExecutor.shutdownNow();
  }

  private void addFinalizer(final Runnable finalizer) {
    addListener(new ServiceListenerAdapter() {
      @Override
      public void terminated(State from) {
        try {
          finalizer.run();
        } catch (Throwable t) {
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

      controller.stop().get(2, TimeUnit.SECONDS);

      Assert.assertEquals(ServiceController.State.TERMINATED, controller.state());

      final CountDownLatch terminateLatch = new CountDownLatch(1);
      service.addListener(new ServiceListenerAdapter() {
        @Override
        public void terminated(Service.State from) {
          terminateLatch.countDown();
        }
      }, Threads.SAME_THREAD_EXECUTOR);
View Full Code Here

      zkClientService.startAndWait();

      final CountDownLatch runLatch = new CountDownLatch(1);
      final CountDownLatch stopLatch = new CountDownLatch(1);
      TwillController controller = getController(zkClientService, runId);
      controller.addListener(new ServiceListenerAdapter() {
        @Override
        public void running() {
          runLatch.countDown();
        }
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.