Package com.twitter.common.zookeeper.SingletonService

Examples of com.twitter.common.zookeeper.SingletonService.LeadershipListener


    Capture<Runnable> handleRegistered = expectFullStartup();
    expectShutdown();

    replayAndCreateLifecycle();

    LeadershipListener leaderListener = schedulerLifecycle.prepare();
    leaderListener.onLeading(leaderControl);
    schedulerLifecycle.registered(new DriverRegistered());
    handleRegistered.getValue().run();
    triggerFailover.getValue().run();
  }
View Full Code Here


    expectShutdown();

    replayAndCreateLifecycle();

    LeadershipListener leaderListener = schedulerLifecycle.prepare();
    leaderListener.onLeading(leaderControl);
    registrationTimeout.getValue().run();
  }
View Full Code Here

    // Important piece here is what's absent - leader presence is not advertised.
    expectShutdown();

    replayAndCreateLifecycle();

    LeadershipListener leaderListener = schedulerLifecycle.prepare();
    leaderListener.onLeading(leaderControl);
    leaderListener.onDefeated(null);
  }
View Full Code Here

    expectLastCall().andThrow(new StorageException("Recovery failed."));
    expectShutdown();

    replayAndCreateLifecycle();

    LeadershipListener leaderListener = schedulerLifecycle.prepare();

    try {
      leaderListener.onLeading(leaderControl);
      fail();
    } catch (StorageException e) {
      // Expected.
    }
  }
View Full Code Here

    Capture<Runnable> handleRegistered = expectFullStartup();
    expectShutdown();

    Capture<Command> shutdownCommand = replayAndCreateLifecycle();

    LeadershipListener leaderListener = schedulerLifecycle.prepare();
    leaderListener.onLeading(leaderControl);
    schedulerLifecycle.registered(new DriverRegistered());
    handleRegistered.getValue().run();
    shutdownCommand.getValue().execute();
  }
View Full Code Here

      Log4jConfigurator.configureConsole(glogConfig.get());
    } else {
      LOG.warning("Running without expected glog configuration.");
    }

    LeadershipListener leaderListener = schedulerLifecycle.prepare();

    Optional<InetSocketAddress> httpSocket =
        Optional.fromNullable(serviceRegistry.getAuxiliarySockets().get("http"));
    if (!httpSocket.isPresent()) {
      throw new IllegalStateException("No HTTP service registered with LocalServiceRegistry.");
View Full Code Here

    // Setup log4j to match our jul glog config in order to pick up zookeeper logging.
    Configuration logConfiguration = RootLogConfig.configurationFromFlags();
    logConfiguration.apply();
    Log4jConfigurator.configureConsole(logConfiguration);

    LeadershipListener leaderListener = schedulerLifecycle.prepare();

    Optional<InetSocketAddress> httpSocket =
        Optional.fromNullable(serviceRegistry.getAuxiliarySockets().get("http"));
    if (!httpSocket.isPresent()) {
      throw new IllegalStateException("No HTTP service registered with LocalServiceRegistry.");
View Full Code Here

    expectFullStartup();
    expectShutdown();

    replayAndCreateLifecycle();

    LeadershipListener leaderListener = schedulerLifecycle.prepare();
    assertEquals(1, statsProvider.getValue(stateGaugeName(State.STORAGE_PREPARED)));
    leaderListener.onLeading(leaderControl);
    assertEquals(1, statsProvider.getValue(stateGaugeName(State.LEADER_AWAITING_REGISTRATION)));
    assertEquals(0, statsProvider.getValue(SchedulerLifecycle.REGISTERED_GAUGE));
    schedulerLifecycle.registered(new DriverRegistered());
    assertEquals(1, statsProvider.getValue(stateGaugeName(State.ACTIVE)));
    assertEquals(1, statsProvider.getValue(SchedulerLifecycle.REGISTERED_GAUGE));
View Full Code Here

    expectShutdown();

    replayAndCreateLifecycle();

    LeadershipListener leaderListener = schedulerLifecycle.prepare();
    leaderListener.onLeading(leaderControl);
    registrationTimeout.getValue().run();
  }
View Full Code Here

    // Important piece here is what's absent - leader presence is not advertised.
    expectShutdown();

    replayAndCreateLifecycle();

    LeadershipListener leaderListener = schedulerLifecycle.prepare();
    leaderListener.onLeading(leaderControl);
    leaderListener.onDefeated(null);
  }
View Full Code Here

TOP

Related Classes of com.twitter.common.zookeeper.SingletonService.LeadershipListener

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.