Package com.linkedin.helix

Examples of com.linkedin.helix.NotificationContext


    HelixManager manager = new MockZKHelixManager(clusterName, controllerName,
                               InstanceType.CONTROLLER_PARTICIPANT,
                               _gZkClient);

    DistClusterControllerElection election = new DistClusterControllerElection(ZK_ADDR);
    NotificationContext context = new NotificationContext(manager);
    context.setType(NotificationContext.Type.CALLBACK);
    election.onControllerChange(context);

    LiveInstance liveInstance = accessor.getProperty(keyBuilder.controllerLeader());
    AssertJUnit.assertEquals(controllerName, liveInstance.getInstanceName());

//    path = PropertyPathConfig.getPath(PropertyType.LEADER, clusterName);
//    ZNRecord leaderRecord = _gZkClient.<ZNRecord> readData(path);
//    AssertJUnit.assertEquals(controllerName, leaderRecord.getSimpleField("LEADER"));
    // AssertJUnit.assertNotNull(election.getController());
    // AssertJUnit.assertNotNull(election.getLeader());

    manager = new MockZKHelixManager(clusterName, "controller_1",
                               InstanceType.CONTROLLER_PARTICIPANT,
                               _gZkClient);
    election = new DistClusterControllerElection(ZK_ADDR);
    context = new NotificationContext(manager);
    context.setType(NotificationContext.Type.CALLBACK);
    election.onControllerChange(context);

    liveInstance = accessor.getProperty(keyBuilder.controllerLeader());
    AssertJUnit.assertEquals(controllerName, liveInstance.getInstanceName());
View Full Code Here


    HelixManager manager = new MockZKHelixManager(clusterName, controllerName,
                               InstanceType.PARTICIPANT,
                               _gZkClient);

    DistClusterControllerElection election = new DistClusterControllerElection(ZK_ADDR);
    NotificationContext context = new NotificationContext(manager);
    context.setType(NotificationContext.Type.INIT);
    election.onControllerChange(context);

    path = PropertyPathConfig.getPath(PropertyType.LEADER, clusterName);
    ZNRecord leaderRecord = _gZkClient.<ZNRecord> readData(path, true);
    AssertJUnit.assertNull(leaderRecord);
View Full Code Here

  @Override
  public void addIdealStateChangeListener(IdealStateChangeListener listener)
  {

    NotificationContext context = new NotificationContext(this);
    context.setType(NotificationContext.Type.INIT);
    List<ZNRecord> idealStates = _clusterView.getPropertyList(PropertyType.IDEALSTATES);
    listener.onIdealStateChange(
        HelixProperty.convertToTypedList(IdealState.class, idealStates), context);
  }
View Full Code Here

  }

  @Override
  public void addMessageListener(MessageListener listener, String instanceName)
  {
    NotificationContext context = new NotificationContext(this);
    context.setType(NotificationContext.Type.INIT);
    List<ZNRecord> messages;
    messages = _clusterView.getMemberInstance(instanceName, true).getInstanceProperty(
        PropertyType.MESSAGES);
    listener.onMessage(instanceName, HelixProperty.convertToTypedList(Message.class, messages),
        context);
View Full Code Here

    {
      logger.info("Cluster is paused. Ignoring the event:" + event.getName());
      return;
    }

    NotificationContext context = null;
    if (event.getAttribute("changeContext") != null)
    {
      context = (NotificationContext) (event.getAttribute("changeContext"));
    }

    // Initialize _clusterStatusMonitor
    if (context != null)
    {
      if (context.getType() == Type.FINALIZE)
      {
        if (_clusterStatusMonitor != null)
        {
          _clusterStatusMonitor.reset();
          _clusterStatusMonitor = null;
View Full Code Here

    }
   
    @Override
    public void run()
    {
      NotificationContext changeContext = new NotificationContext(_manager);
      changeContext.setType(NotificationContext.Type.CALLBACK);
      ClusterEvent event = new ClusterEvent("periodicalRebalance");
      event.addAttribute("helixmanager", changeContext.getManager());
      event.addAttribute("changeContext", changeContext);
      List<ZNRecord> dummy = new ArrayList<ZNRecord>();
      event.addAttribute("eventData", dummy);
      // Should be able to process 
      handleEvent(event);
View Full Code Here

    externalViews.add(externalView);
    externalViews.add(externalView2);

    ClusterStatusMonitor monitor = new ClusterStatusMonitor("cluster1");
    MockHelixManager manager = new MockHelixManager();
    NotificationContext context = new NotificationContext(manager);
    System.out.println("END TestClusterStatusMonitor at" + new Date(System.currentTimeMillis()));
  }
View Full Code Here

TOP

Related Classes of com.linkedin.helix.NotificationContext

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.