ControllerId controllerId = ControllerId.from("exampleController");
HelixController helixController = connection.createController(clusterId, controllerId);
helixController.startAsync();
// start the specified participant
HelixParticipant helixParticipant =
connection.createParticipant(clusterId, participant.getId());
helixParticipant.getStateMachineEngine().registerStateModelFactory(
lockUnlock.getStateModelDefId(), new LockUnlockFactory());
helixParticipant.startAsync();
// start another participant via auto join
HelixParticipant autoJoinParticipant =
connection.createParticipant(clusterId, ParticipantId.from("localhost_12120"));
autoJoinParticipant.getStateMachineEngine().registerStateModelFactory(
lockUnlock.getStateModelDefId(), new LockUnlockFactory());
autoJoinParticipant.startAsync();
Thread.sleep(5000);
printExternalView(connection, clusterId, resource.getId());
// stop the participants
helixParticipant.stopAsync();
autoJoinParticipant.stopAsync();
// stop the controller
helixController.stopAsync();
// drop the cluster