Package io.druid.curator.announcement

Examples of io.druid.curator.announcement.Announcer


    cf.start();
    cf.create().creatingParentsIfNeeded().forPath(testBasePath);

    jsonMapper = new DefaultObjectMapper();

    announcer = new Announcer(
        cf,
        MoreExecutors.sameThreadExecutor()
    );
    announcer.start();
View Full Code Here


    cf.start();
    cf.create().creatingParentsIfNeeded().forPath(testBasePath);

    jsonMapper = new DefaultObjectMapper();

    announcer = new Announcer(
        cf,
        MoreExecutors.sameThreadExecutor()
    );
    announcer.start();
View Full Code Here

          @Bridge
          public Announcer getBridgeAnnouncer(
              @Bridge CuratorFramework curator
          )
          {
            return new Announcer(curator, Execs.singleThreaded("BridgeAnnouncer-%s"));
          }

          @Provides
          @ManageLifecycleLast
          @Bridge
View Full Code Here

    announceCount = new AtomicInteger(0);
    announcer = new DataSegmentAnnouncer()
    {
      private final DataSegmentAnnouncer delegate = new SingleDataSegmentAnnouncer(
          me, zkPaths, new Announcer(curator, Execs.singleThreaded("blah")), jsonMapper
      );

      @Override
      public void announceSegment(DataSegment segment) throws IOException
      {
View Full Code Here

  @Provides
  @ManageLifecycle
  public Announcer getAnnouncer(CuratorFramework curator)
  {
    return new Announcer(curator, Execs.singleThreaded("Announcer-%s"));
  }
View Full Code Here

        dbSegmentPublisher,
        databaseSegmentManager,
        serverView
    );

    Announcer announcer = new Announcer(remoteCf, Executors.newSingleThreadExecutor());
    announcer.start();
    announcer.announce(zkPathsConfig.getAnnouncementsPath() + "/" + me.getHost(), jsonMapper.writeValueAsBytes(me));

    BatchDataSegmentAnnouncer batchDataSegmentAnnouncer = EasyMock.createMock(BatchDataSegmentAnnouncer.class);
    BatchServerInventoryView batchServerInventoryView = EasyMock.createMock(BatchServerInventoryView.class);
    EasyMock.expect(batchServerInventoryView.getInventory()).andReturn(
        Arrays.asList(
            new DruidServer("1", "localhost", 117, "historical", DruidServer.DEFAULT_TIER, 0),
            new DruidServer("2", "localhost", 1, "historical", DruidServer.DEFAULT_TIER, 0)
        )
    );
    batchServerInventoryView.registerSegmentCallback(
        EasyMock.<Executor>anyObject(),
        EasyMock.<ServerView.SegmentCallback>anyObject()
    );
    batchServerInventoryView.registerServerCallback(
        EasyMock.<Executor>anyObject(),
        EasyMock.<ServerView.ServerCallback>anyObject()
    );
    EasyMock.expectLastCall();
    batchServerInventoryView.start();
    EasyMock.expectLastCall();
    batchServerInventoryView.stop();
    EasyMock.expectLastCall();
    EasyMock.replay(batchServerInventoryView);

    DruidClusterBridge bridge = new DruidClusterBridge(
        jsonMapper,
        config,
        factory,
        me,
        localCf,
        leaderLatch,
        bridgeZkCoordinator,
        announcer,
        batchDataSegmentAnnouncer,
        batchServerInventoryView
    );

    bridge.start();

    int retry = 0;
    while (!bridge.isLeader()) {
      if (retry > 5) {
        throw new ISE("Unable to become leader");
      }

      Thread.sleep(100);
      retry++;
    }

    String path = "/druid/announcements/localhost:8080";
    retry = 0;
    while (remoteCf.checkExists().forPath(path) == null) {
      if (retry > 5) {
        throw new ISE("Unable to announce");
      }

      Thread.sleep(100);
      retry++;
    }

    boolean verified = verifyUpdate(jsonMapper, path, remoteCf);
    retry = 0;
    while (!verified) {
      if (retry > 5) {
        throw new ISE("No updates to bridge node occurred");
      }

      Thread.sleep(100);
      retry++;

      verified = verifyUpdate(jsonMapper, path, remoteCf);
    }

    announcer.stop();
    bridge.stop();

    remoteCf.close();
    remoteCluster.close();
    localCf.close();
View Full Code Here

    this.jsonMapper = jsonMapper;
    this.config = config;
    this.curatorFramework = curatorFramework;
    this.worker = worker;

    this.announcer = new Announcer(curatorFramework, MoreExecutors.sameThreadExecutor());

    this.baseAnnouncementsPath = getPath(Arrays.asList(zkPaths.getIndexerAnnouncementPath(), worker.getHost()));
    this.baseTaskPath = getPath(Arrays.asList(zkPaths.getIndexerTaskPath(), worker.getHost()));
    this.baseStatusPath = getPath(Arrays.asList(zkPaths.getIndexerStatusPath(), worker.getHost()));
  }
View Full Code Here

TOP

Related Classes of io.druid.curator.announcement.Announcer

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.