On resource events, if applyable, attempt to alter channels to drop the
global subscription and set it to group channels
438428
public function onNodeResourceEventAlterChannels(Event $event)
    {
        if (!$this->groupManager || !$event instanceof ResourceEvent) {
            return;
        }

        $done = [];

        // Fetch site groups, and yes we don't really have a choice here
        $nodes = $this->entityManager->getStorage('node')->loadMultiple($event->getResourceIdList());
        foreach ($nodes as $node) {
            if ($node->group_id) {
                $groupId = (int)$node->group_id;
                $done[$groupId] = $groupId;
            }
        }

        foreach ($done as $groupId) {
            $event->addArbitraryChanId('admin:content:' . $groupId);
        }
    }
412202
def _dispatch_event(self, event: LutronEvent, params: Dict):
    """"""
    for handler, context in self._subscribers:
      handler(self, context, event, params)
1250927
function onDeactivateEvent() {
         // cancel all event subscriptions
         me.event.unsubscribe(this.vpChangeHdlr);
         me.event.unsubscribe(this.vpResizeHdlr);
         me.event.unsubscribe(this.vpLoadedHdlr);
       }
552757
def _bind_channels(self, events, channels):
        
        for channel_name in channels:
            if channel_name in self.channels:
                channel = self.pusher.subscribe(channel_name)
                if isinstance(events, list):
                    for event in events:
                        channel.bind(event, channels[channel_name])
                else:
                    channel.bind(events, channels[channel_name])
1148741
function(names, cb) {
      if (!cb) {
        cb = function() {};
      }
      if (!session.channels) {
        session.channels = [];
      }
      forceArray(names).forEach(function(name) {
        var i;
        if ((i = session.channels.indexOf(name)) >= 0) {
          session.channels.splice(i, 1);
          subscriptions.channel.remove(name, socketId);
          return ss.log.info('i'.green + ' unsubscribed sessionId '.grey + session.id + ' from channel '.grey + name);
        }
      });
      return session.save(cb);
    }
1234274
public void parameterizeChannel(Channel channel) {
		LocalProperties current = channel.getLocalProperties();
		
		if (isMetBy(current)) {
			// we are met, all is good
			channel.setLocalStrategy(LocalStrategy.NONE);
		}
		else if (this.ordering != null) {
			channel.setLocalStrategy(LocalStrategy.SORT, this.ordering.getInvolvedIndexes(), this.ordering.getFieldSortDirections());
		}
		else if (this.groupedFields != null) {
			boolean[] dirs = new boolean[this.groupedFields.size()];
			Arrays.fill(dirs, true);
			channel.setLocalStrategy(LocalStrategy.SORT, Utils.createOrderedFromSet(this.groupedFields), dirs);
		}
		else {
			channel.setLocalStrategy(LocalStrategy.NONE);
		}
	}
166687
def remove(self, event, subscriber):
        
        subs = self._subscribers
        if event not in subs:
            raise ValueError('No subscribers: %r' % event)
        subs[event].remove(subscriber)
926900
function () {
    var self = this;

    _.each(self._namedSubs, function (sub, id) {
      sub._deactivate();
    });
    self._namedSubs = {};

    _.each(self._universalSubs, function (sub) {
      sub._deactivate();
    });
    self._universalSubs = [];
  }
358942
public void onManagerEvent(ManagerEvent event)
    {
        // Handle Channel related events
        if (event instanceof ConnectEvent)
        {
            handleConnectEvent((ConnectEvent) event);
        }
        else if (event instanceof DisconnectEvent)
        {
            handleDisconnectEvent((DisconnectEvent) event);
        }
        else if (event instanceof NewChannelEvent)
        {
            channelManager.handleNewChannelEvent((NewChannelEvent) event);
        }
        else if (event instanceof NewExtenEvent)
        {
            channelManager.handleNewExtenEvent((NewExtenEvent) event);
        }
        else if (event instanceof NewStateEvent)
        {
            channelManager.handleNewStateEvent((NewStateEvent) event);
        }
        else if (event instanceof NewCallerIdEvent)
        {
            channelManager.handleNewCallerIdEvent((NewCallerIdEvent) event);
        }
        else if (event instanceof DialEvent)
        {
            channelManager.handleDialEvent((DialEvent) event);
        }
        else if (event instanceof BridgeEvent)
        {
            channelManager.handleBridgeEvent((BridgeEvent) event);
        }
        else if (event instanceof RenameEvent)
        {
            channelManager.handleRenameEvent((RenameEvent) event);
        }
        else if (event instanceof HangupEvent)
        {
            channelManager.handleHangupEvent((HangupEvent) event);
        }
        else if (event instanceof CdrEvent)
        {
            channelManager.handleCdrEvent((CdrEvent) event);
        }
        else if (event instanceof VarSetEvent)
        {
            channelManager.handleVarSetEvent((VarSetEvent) event);
        }
        else if (event instanceof DtmfEvent)
        {
            channelManager.handleDtmfEvent((DtmfEvent) event);
        }
        else if (event instanceof MonitorStartEvent)
        {
            channelManager.handleMonitorStartEvent((MonitorStartEvent) event);
        }
        else if (event instanceof MonitorStopEvent)
        {
            channelManager.handleMonitorStopEvent((MonitorStopEvent) event);
        }
        // End of channel related events
        // Handle parking related event
        else if (event instanceof ParkedCallEvent)
        {
            channelManager.handleParkedCallEvent((ParkedCallEvent) event);
        }
        else if (event instanceof ParkedCallGiveUpEvent)
        {
            channelManager.handleParkedCallGiveUpEvent((ParkedCallGiveUpEvent) event);
        }
        else if (event instanceof ParkedCallTimeOutEvent)
        {
            channelManager.handleParkedCallTimeOutEvent((ParkedCallTimeOutEvent) event);
        }
        else if (event instanceof UnparkedCallEvent)
        {
            channelManager.handleUnparkedCallEvent((UnparkedCallEvent) event);
        }
        // End of parking related events
        // Handle queue related event
        else if (event instanceof JoinEvent)
        {
            queueManager.handleJoinEvent((JoinEvent) event);
        }
        else if (event instanceof LeaveEvent)
        {
            queueManager.handleLeaveEvent((LeaveEvent) event);
        }
        else if (event instanceof QueueMemberStatusEvent)
        {
            queueManager.handleQueueMemberStatusEvent((QueueMemberStatusEvent) event);
        }
        else if (event instanceof QueueMemberPenaltyEvent)
        {
            queueManager.handleQueueMemberPenaltyEvent((QueueMemberPenaltyEvent) event);
        }
        else if (event instanceof QueueMemberAddedEvent)
        {
            queueManager.handleQueueMemberAddedEvent((QueueMemberAddedEvent) event);
        }
        else if (event instanceof QueueMemberRemovedEvent)
        {
            queueManager.handleQueueMemberRemovedEvent((QueueMemberRemovedEvent) event);
        }
        else if (event instanceof QueueMemberPausedEvent)
        {
            queueManager.handleQueueMemberPausedEvent((QueueMemberPausedEvent) event);
        }
        // >>>>>> AJ 94
        // Handle meetMeEvents
        else if (event instanceof AbstractMeetMeEvent)
        {
            meetMeManager.handleMeetMeEvent((AbstractMeetMeEvent) event);
        }
        else if (event instanceof OriginateResponseEvent)
        {
            handleOriginateEvent((OriginateResponseEvent) event);
        }
        // Handle agents-related events
        else if (event instanceof AgentsEvent)
        {
            agentManager.handleAgentsEvent((AgentsEvent) event);
        }
        else if (event instanceof AgentCalledEvent)
        {
            agentManager.handleAgentCalledEvent((AgentCalledEvent) event);
        }
        else if (event instanceof AgentConnectEvent)
        {
            agentManager.handleAgentConnectEvent((AgentConnectEvent) event);
        }
        else if (event instanceof AgentCompleteEvent)
        {
            agentManager.handleAgentCompleteEvent((AgentCompleteEvent) event);
        }
        else if (event instanceof AgentCallbackLoginEvent)
        {
            agentManager.handleAgentCallbackLoginEvent((AgentCallbackLoginEvent) event);
        }
        else if (event instanceof AgentCallbackLogoffEvent)
        {
            agentManager.handleAgentCallbackLogoffEvent((AgentCallbackLogoffEvent) event);
        }
        else if (event instanceof AgentLoginEvent)
        {
            agentManager.handleAgentLoginEvent((AgentLoginEvent) event);
        }
        else if (event instanceof AgentLogoffEvent)
        {
            agentManager.handleAgentLogoffEvent((AgentLogoffEvent) event);
        }
        // End of agent-related events

        // dispatch the events to the chainListener if they exist.
        fireChainListeners(event);
    }
350369
def _on_group_stream_changed(self, data):
        """"""
        self._groups.get(data.get('id')).update_stream(data)
496395
function() {

		for (var name in this._events_listeners) {

			if (this._events_listeners[name]) {

				Lava.Core.removeGlobalHandler(this._events_listeners[name]);
				this._events_listeners[name] = null;
				this._event_usage_counters[name] = 0;

			}

		}

	}
884930
def auto_subscribe(self, app_manager):
        """"""
        for handler in app_manager.handler_classes:
            app_manager.subscribe(handler.channel(), self)
125432
@Override
	public void on(String name, Tree payload, Groups groups, boolean broadcast) throws Exception {
		FastBuildTree msg = new FastBuildTree(6);
		msg.putUnsafe("ver", ServiceBroker.PROTOCOL_VERSION);
		msg.putUnsafe("sender", currentNodeID);
		msg.putUnsafe("event", name);
		msg.putUnsafe("broadcast", broadcast);
		if (groups != null) {
			String[] array = groups.groups();
			if (array != null && array.length > 0) {
				msg.putUnsafe("groups", array);
			}
		}
		if (payload != null) {
			msg.putUnsafe("data", payload);
		}
		transporter.publish(PACKET_EVENT, nodeID, msg);
	}
1239878
public void shutdownNow() {
        allChannels.close();
        workerGroup.shutdownGracefully();
        bossGroup.shutdownGracefully();
        clientGroup.shutdownGracefully();
        if (pipeliningGroup != null) {
            pipeliningGroup.shutdownGracefully();
        }
    }
594165
@Handler(priority = 1000)
    public void onProtocolSwitchAccepted(
            ProtocolSwitchAccepted event, IOSubchannel channel) {
        event.requestEvent().associated(Selection.class)
            .ifPresent(
                selection -> channel.setAssociated(Selection.class, selection));
    }
1330933
function Session_delChannel(channel) {
  var index = this.channels.indexOf(channel)
  if (-1 == index) return

  this.channels.splice(index, 1)
}
927613
void reSubscribeByName(EventChannelStruct event_channel_struct, String name) {
        Enumeration callback_structs = event_callback_map.elements();
        while (callback_structs.hasMoreElements()) {
            EventCallBackStruct callback_struct = (EventCallBackStruct) callback_structs.nextElement();
            if (callback_struct.channel_name.equals(name)) {
                reSubscribe(event_channel_struct, callback_struct);
            }
        }
    }