Package org.apache.helix.participant

Examples of org.apache.helix.participant.StateMachineEngine


      });

      _participants[i] = new MockParticipant(_zkaddr, CLUSTER_NAME, instanceName);

      // Register a Task state model factory.
      StateMachineEngine stateMachine = _participants[i].getStateMachineEngine();
      stateMachine.registerStateModelFactory(StateModelDefId.from("Task"),
          new TaskStateModelFactory(_participants[i], taskFactoryReg));
      _participants[i].syncStart();
    }

    // Start controller
View Full Code Here


      stateModelFactory = new OnlineOfflineStateModelFactory(delay);
    } else if ("LeaderStandby".equalsIgnoreCase(stateModelType)) {
      stateModelFactory = new LeaderStandbyStateModelFactory(delay);
    }

    StateMachineEngine stateMach = manager.getStateMachineEngine();
    stateMach.registerStateModelFactory(StateModelDefId.from(stateModelType), stateModelFactory);
    manager.connect();
    manager.getMessagingService().registerMessageHandlerFactory(
        MessageType.STATE_TRANSITION.toString(), stateMach);
  }
View Full Code Here

                InstanceType.CONTROLLER_PARTICIPANT, zkConnectString);

        MultiClusterControllerTransitionHandlerFactory stateModelFactory =
            new MultiClusterControllerTransitionHandlerFactory(zkConnectString);

        StateMachineEngine stateMach = manager.getStateMachineEngine();
        stateMach.registerStateModelFactory(StateModelDefId.LeaderStandby, stateModelFactory);
        manager.connect();
      } else {
        logger.error("cluster controller mode:" + controllerMode + " NOT supported");
      }
    } catch (Exception e) {
View Full Code Here

              InstanceType.PARTICIPANT, ZK_ADDRESS);

      MasterSlaveStateModelFactory stateModelFactory =
          new MasterSlaveStateModelFactory(instanceName);

      StateMachineEngine stateMach = manager.getStateMachineEngine();
      stateMach.registerStateModelFactory(STATE_MODEL_NAME, stateModelFactory);
      manager.connect();
    }
View Full Code Here

    try {
      _manager =
          HelixManagerFactory.getZKHelixManager(_clusterName, _consumerId,
              InstanceType.PARTICIPANT, _zkAddr);

      StateMachineEngine stateMach = _manager.getStateMachineEngine();
      ConsumerStateTransitionHandlerFactory transitionHandlerFactory =
          new ConsumerStateTransitionHandlerFactory(_consumerId, _mqServer);
      stateMach.registerStateModelFactory(
          StateModelDefId.from(SetupConsumerCluster.DEFAULT_STATE_MODEL), transitionHandlerFactory);

      _manager.connect();

      Thread.currentThread().join();
View Full Code Here

  public void run() {
    try {
      DummyStateModelFactory stateModelFactory = new DummyStateModelFactory(0);
      // StateMachineEngine genericStateMachineHandler =
      // new StateMachineEngine();
      StateMachineEngine stateMach = _manager.getStateMachineEngine();
      stateMach.registerStateModelFactory(StateModelDefId.MasterSlave, stateModelFactory);

      DummyLeaderStandbyStateModelFactory stateModelFactory1 =
          new DummyLeaderStandbyStateModelFactory(10);
      DummyOnlineOfflineStateModelFactory stateModelFactory2 =
          new DummyOnlineOfflineStateModelFactory(10);
      stateMach.registerStateModelFactory(StateModelDefId.LeaderStandby, stateModelFactory1);
      stateMach.registerStateModelFactory(StateModelDefId.OnlineOffline, stateModelFactory2);
      // _manager.getMessagingService()
      // .registerMessageHandlerFactory(MessageType.STATE_TRANSITION.toString(),
      // genericStateMachineHandler);

      _manager.connect();
View Full Code Here

  }

  @Override
  public void run() {
    try {
      StateMachineEngine stateMach = getStateMachineEngine();
      MultiClusterControllerTransitionHandlerFactory lsModelFactory =
          new MultiClusterControllerTransitionHandlerFactory(_zkAddress);
      stateMach.registerStateModelFactory(StateModelDefId.LeaderStandby, lsModelFactory);

      connect();
      _startCountDown.countDown();
      _stopCountDown.await();
    } catch (Exception e) {
View Full Code Here

  }

  @Override
  public void run() {
    try {
      StateMachineEngine stateMach = getStateMachineEngine();
      stateMach.registerStateModelFactory(StateModelDefId.MasterSlave, _msModelFactory);

      DummyLeaderStandbyStateModelFactory lsModelFactory =
          new DummyLeaderStandbyStateModelFactory(10);
      DummyOnlineOfflineStateModelFactory ofModelFactory =
          new DummyOnlineOfflineStateModelFactory(10);
      stateMach.registerStateModelFactory(StateModelDefId.LeaderStandby, lsModelFactory);
      stateMach.registerStateModelFactory(StateModelDefId.OnlineOffline, ofModelFactory);

      MockSchemataModelFactory schemataFactory = new MockSchemataModelFactory();
      stateMach.registerStateModelFactory(StateModelDefId.from("STORAGE_DEFAULT_SM_SCHEMATA"), schemataFactory);

      connect();
      _startCountDown.countDown();

      _stopCountDown.await();
View Full Code Here

    try {
      manager =
          HelixManagerFactory.getZKHelixManager(clusterName, instanceName,
              InstanceType.PARTICIPANT, zkAddr);

      StateMachineEngine stateMach = manager.getStateMachineEngine();
      DummyMSModelFactory msModelFactory = new DummyMSModelFactory();
      stateMach.registerStateModelFactory(StateModelDefId.MasterSlave, msModelFactory);

      manager.connect();

      Thread.currentThread().join();
    } catch (Exception e) {
View Full Code Here

        HelixManagerFactory.getZKHelixManager(clusterName, instanceName, InstanceType.PARTICIPANT,
            zkConnectString);

    stateModelFactory = new BootstrapHandler();

    StateMachineEngine stateMach = manager.getStateMachineEngine();
    stateMach.registerStateModelFactory(StateModelDefId.MasterSlave, stateModelFactory);

    manager.getMessagingService().registerMessageHandlerFactory(
        MessageType.STATE_TRANSITION.toString(), stateMach);
    manager.getMessagingService().registerMessageHandlerFactory(
        MessageType.USER_DEFINE_MSG.toString(), new CustomMessageHandlerFactory());
View Full Code Here

TOP

Related Classes of org.apache.helix.participant.StateMachineEngine

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.