void initHandlers(List<CallbackHandler> handlers) { synchronized (this) { if (handlers != null) { for (CallbackHandler handler : handlers) { handler.init(); LOG.info("init handler: " + handler.getPath() + ", " + handler.getListener()); } } } }
void initHandlers(List<CallbackHandler> handlers) { synchronized (this) { if (handlers != null) { for (CallbackHandler handler : handlers) { handler.init(); LOG.info("init handler: " + handler.getPath() + ", " + handler.getListener()); } } } }
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)); } }
public CallbackHandler(HelixManager manager, ZkClient client, PropertyKey propertyKey, Object listener, EventType[] eventTypes, ChangeType changeType, HelixCallbackMonitor monitor) { if (listener == null) { throw new HelixException("listener could not be null"); } if (monitor != null && !monitor.getChangeType().equals(changeType)) { throw new HelixException( "The specified callback monitor is for different change type: " + monitor.getChangeType() .name()); } _manager = manager; _accessor = manager.getHelixDataAccessor(); _zkClient = client; _propertyKey = propertyKey; _path = propertyKey.getPath(); _listener = listener; _eventTypes = new HashSet<>(Arrays.asList(eventTypes)); _changeType = changeType; _lastNotificationTimeStamp = new AtomicLong(System.nanoTime()); _monitor = monitor; if (_changeType == MESSAGE || _changeType == MESSAGES_CONTROLLER || _changeType == CONTROLLER) { _watchChild = false; } else { _watchChild = true; } parseListenerProperties(); init(); }
public CallbackHandler(HelixManager manager, HelixZkClient client, PropertyKey propertyKey, Object listener, EventType[] eventTypes, ChangeType changeType, HelixCallbackMonitor monitor) { if (listener == null) { throw new HelixException("listener could not be null"); } if (monitor != null && !monitor.getChangeType().equals(changeType)) { throw new HelixException( "The specified callback monitor is for different change type: " + monitor.getChangeType() .name()); } _manager = manager; _accessor = manager.getHelixDataAccessor(); _zkClient = client; _propertyKey = propertyKey; _path = propertyKey.getPath(); _listener = listener; _eventTypes = new HashSet<>(Arrays.asList(eventTypes)); _changeType = changeType; _lastNotificationTimeStamp = new AtomicLong(System.nanoTime()); _monitor = monitor; if (_changeType == MESSAGE || _changeType == MESSAGES_CONTROLLER || _changeType == CONTROLLER) { _watchChild = false; } else { _watchChild = true; } parseListenerProperties(); init(); }