Package org.apache.helix.participant

Examples of org.apache.helix.participant.StateMachineEngine


    stateModelFactory = new DummyStateModelFactory(_transDelayInMs);
    DummyLeaderStandbyStateModelFactory stateModelFactory1 =
        new DummyLeaderStandbyStateModelFactory(_transDelayInMs);
    DummyOnlineOfflineStateModelFactory stateModelFactory2 =
        new DummyOnlineOfflineStateModelFactory(_transDelayInMs);
    StateMachineEngine stateMach = manager.getStateMachineEngine();
    stateMach.registerStateModelFactory(StateModelDefId.MasterSlave, stateModelFactory);
    stateMach.registerStateModelFactory(StateModelDefId.LeaderStandby, stateModelFactory1);
    stateMach.registerStateModelFactory(StateModelDefId.OnlineOffline, stateModelFactory2);

    manager.connect();
    return manager;
  }
View Full Code Here


        Field sessionTimeout = ZkHelixConnection.class.getDeclaredField("_sessionTimeout");
        sessionTimeout.setAccessible(true);
        sessionTimeout.setInt(participant.getConn(), 1000);
      }

      StateMachineEngine stateMach = participant.getStateMachineEngine();
      stateMach.registerStateModelFactory(StateModelDefId.MasterSlave, new MyStateModelFactory(participant));
      participant.connect();

      StatusPrinter statusPrinter = new StatusPrinter();
      statusPrinter.registerWith(participant);
    }
View Full Code Here

    return _role.getConnection().getHelixProperties();
  }

  @Override
  public StateMachineEngine getStateMachineEngine() {
    StateMachineEngine engine = null;
    switch (_role.getType()) {
    case PARTICIPANT: {
      HelixParticipant participant = (HelixParticipant) _role;
      engine = participant.getStateMachineEngine();
      break;
View Full Code Here

      String instanceName = "localhost_" + (12918 + i);

      participants[i] = new MockParticipant(_zkaddr, clusterName, instanceName);

      // add a state model with non-OFFLINE initial state
      StateMachineEngine stateMach = participants[i].getStateMachineEngine();
      MockBootstrapModelFactory bootstrapFactory = new MockBootstrapModelFactory();
      stateMach.registerStateModelFactory(StateModelDefId.from("Bootstrap"), bootstrapFactory);

      participants[i].syncStart();
    }

    boolean result =
View Full Code Here

              InstanceType.PARTICIPANT, ZK_ADDRESS);

      MasterSlaveStateModelFactory stateModelFactory =
          new MasterSlaveStateModelFactory(instanceName);

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

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

      StateMachineEngine stateMach = _manager.getStateMachineEngine();
      TaskStateModelFactory modelFactory =
          new TaskStateModelFactory(_instanceName, _taskFactory, _taskResultStore);
      stateMach.registerStateModelFactory(StateModelDefId.from(TaskCluster.DEFAULT_STATE_MODEL),
          modelFactory);

      _manager.connect();

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

    String stateModelName = cmd.getOptionValue(stateModel);

    HelixManager manager =
        new ZKHelixManager(clusterName, instance, InstanceType.PARTICIPANT, zkAddress);

    StateMachineEngine stateMach = manager.getStateMachineEngine();
    stateMach.registerStateModelFactory(StateModelDefId.from(stateModelName),
        new AgentStateModelFactory());

    Runtime.getRuntime().addShutdownHook(new HelixAgentShutdownHook(manager));

    try {
View Full Code Here

    }
    // genericStateMachineHandler = new StateMachineEngine();
    // genericStateMachineHandler.registerStateModelFactory(stateModelType,
    // stateModelFactory);

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

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

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

      _manager.connect();

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

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

      StateMachineEngine stateMach = _manager.getStateMachineEngine();
      FileStoreStateModelFactory modelFactory = new FileStoreStateModelFactory(_manager);
      stateMach.registerStateModelFactory(StateModelDefId.from(SetupCluster.DEFAULT_STATE_MODEL),
          modelFactory);
      _manager.connect();
      // _manager.addExternalViewChangeListener(replicator);
      Thread.currentThread().join();
    } catch (InterruptedException e) {
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.