void handleNewSessionAsController() { if (_leaderElectionHandler != null) { _leaderElectionHandler.init(); } else { _leaderElectionHandler = new CallbackHandler(this, _zkclient, _keyBuilder.controller(), new DistributedLeaderElection(this, _controller, _controllerTimerTasks), new EventType[] { EventType.NodeChildrenChanged, EventType.NodeDeleted, EventType.NodeCreated }, ChangeType.CONTROLLER, _callbackMonitors.get(ChangeType.CONTROLLER)); } }
void handleNewSessionAsController() { if (_leaderElectionHandler != null) { _leaderElectionHandler.init(); } else { _leaderElectionHandler = new CallbackHandler(this, _zkclient, _keyBuilder.controller(), new DistributedLeaderElection(this, _controller, _controllerTimerTasks), new EventType[] { EventType.NodeChildrenChanged, EventType.NodeDeleted, EventType.NodeCreated }, ChangeType.CONTROLLER, _callbackMonitors.get(ChangeType.CONTROLLER)); } }
@Test() public void testParticipant() throws Exception { String className = getShortClassName(); LOG.info("RUN " + className + " at " + new Date(System.currentTimeMillis())); final String clusterName = CLUSTER_PREFIX + "_" + className + "_" + "testParticipant"; TestHelper.setupEmptyCluster(_gZkClient, clusterName); final String controllerName = "participant_0"; HelixManager manager = new MockZKHelixManager(clusterName, controllerName, InstanceType.PARTICIPANT, _gZkClient); GenericHelixController participant0 = new GenericHelixController(); List<HelixTimerTask> timerTasks = Collections.emptyList(); try { DistributedLeaderElection election = new DistributedLeaderElection(manager, participant0, timerTasks); Assert.fail( "Should not be able construct DistributedLeaderElection object using participant manager."); } catch (HelixException ex) { // expected } TestHelper.dropCluster(clusterName, _gZkClient); }
GenericHelixController controller0 = new GenericHelixController(); DistributedLeaderElection election = new DistributedLeaderElection(manager, controller0, Collections.EMPTY_LIST); manager.connect(); managerList.put(manager.getInstanceName(), manager);
new DistributedLeaderElection(manager, controller0, timerTasks); NotificationContext context = new NotificationContext(manager); context.setType(NotificationContext.Type.INIT); new MockZKHelixManager(clusterName, "controller_1", InstanceType.CONTROLLER, _gZkClient); GenericHelixController controller1 = new GenericHelixController(); election = new DistributedLeaderElection(manager, controller1, timerTasks); context = new NotificationContext(manager); context.setType(NotificationContext.Type.INIT);
new DistributedLeaderElection(manager, controller0, timerTasks); NotificationContext context = new NotificationContext(manager); context.setType(NotificationContext.Type.CALLBACK); _gZkClient); GenericHelixController controller1 = new GenericHelixController(); election = new DistributedLeaderElection(manager, controller1, timerTasks); context = new NotificationContext(manager); context.setType(NotificationContext.Type.CALLBACK);
GenericHelixController controller0 = new GenericHelixController(); DistributedLeaderElection election = new DistributedLeaderElection(manager, controller0, Collections.EMPTY_LIST); manager.connect();