use of org.apache.helix.participant.DistClusterControllerStateModelFactory in project helix by apache.
the class HelixControllerMain method startHelixController.
public static HelixManager startHelixController(final String zkConnectString, final String clusterName, final String controllerName, final String controllerMode) {
HelixManager manager = null;
try {
if (controllerMode.equalsIgnoreCase(STANDALONE)) {
manager = HelixManagerFactory.getZKHelixManager(clusterName, controllerName, InstanceType.CONTROLLER, zkConnectString);
manager.connect();
} else if (controllerMode.equalsIgnoreCase(DISTRIBUTED)) {
manager = HelixManagerFactory.getZKHelixManager(clusterName, controllerName, InstanceType.CONTROLLER_PARTICIPANT, zkConnectString);
DistClusterControllerStateModelFactory stateModelFactory = new DistClusterControllerStateModelFactory(zkConnectString);
StateMachineEngine stateMach = manager.getStateMachineEngine();
stateMach.registerStateModelFactory("LeaderStandby", stateModelFactory);
manager.connect();
} else {
logger.error("cluster controller mode:" + controllerMode + " NOT supported");
}
} catch (Exception e) {
logger.error("Exception while starting controller", e);
}
return manager;
}
use of org.apache.helix.participant.DistClusterControllerStateModelFactory in project helix by apache.
the class TestDistControllerStateModelFactory method testDistControllerStateModelFactory.
@Test()
public void testDistControllerStateModelFactory() {
DistClusterControllerStateModelFactory factory = new DistClusterControllerStateModelFactory(zkAddr);
DistClusterControllerStateModel stateModel = factory.createNewStateModel("name", "key");
stateModel.onBecomeStandbyFromOffline(null, null);
}
use of org.apache.helix.participant.DistClusterControllerStateModelFactory in project helix by apache.
the class ClusterDistributedController method run.
@Override
public void run() {
try {
StateMachineEngine stateMach = getStateMachineEngine();
DistClusterControllerStateModelFactory lsModelFactory = new DistClusterControllerStateModelFactory(_zkAddress);
stateMach.registerStateModelFactory("LeaderStandby", lsModelFactory);
connect();
_startCountDown.countDown();
_stopCountDown.await();
} catch (Exception e) {
LOG.error("exception running controller-manager", e);
} finally {
_startCountDown.countDown();
disconnect();
_waitStopFinishCountDown.countDown();
}
}
Aggregations