Registers a broadcast listener that gets notified in case the broadcast
is fired.

@param broadcastName     the broadcast name as defined in the Franca model
to subscribe to.
@param broadcastListener the listener to add.
321172
@Override
    public void registerBroadcastListener(String broadcastName, BroadcastListener broadcastListener) {
        broadcastListeners.putIfAbsent(broadcastName, new ArrayList<BroadcastListener>());
        List<BroadcastListener> listeners = broadcastListeners.get(broadcastName);
        synchronized (listeners) {
            listeners.add(broadcastListener);
        }
    }
228858
void register(Object listener) {
    Multimap<Class<?>, Subscriber> listenerMethods = findAllSubscribers(listener);

    for (Map.Entry<Class<?>, Collection<Subscriber>> entry : listenerMethods.asMap().entrySet()) {
      Class<?> eventType = entry.getKey();
      Collection<Subscriber> eventMethodsInListener = entry.getValue();

      CopyOnWriteArraySet<Subscriber> eventSubscribers = subscribers.get(eventType);

      if (eventSubscribers == null) {
        CopyOnWriteArraySet<Subscriber> newSet = new CopyOnWriteArraySet<Subscriber>();
        eventSubscribers =
            MoreObjects.firstNonNull(subscribers.putIfAbsent(eventType, newSet), newSet);
      }

      eventSubscribers.addAll(eventMethodsInListener);
    }
  }
227620
def register(listener):
    
    if not isinstance(listener, _EventListener):
        raise TypeError("Listeners for %s must be either a "
                        "CommandListener, ServerHeartbeatListener, "
                        "ServerListener, or TopologyListener." % (listener,))
    if isinstance(listener, CommandListener):
        _LISTENERS.command_listeners.append(listener)
    if isinstance(listener, ServerHeartbeatListener):
        _LISTENERS.server_heartbeat_listeners.append(listener)
    if isinstance(listener, ServerListener):
        _LISTENERS.server_listeners.append(listener)
    if isinstance(listener, TopologyListener):
        _LISTENERS.topology_listeners.append(listener)
914054
@Override
  public void addListener(final AgentModel.Listener listener) {
    listeners.add(listener);
    listener.tasksChanged(this);
  }
626094
public void addListener(BaseListener listener)
    {
        listener.setNextListener(null);  // Just being safe
        if ((this.getRecord() != null) && (this.getRecord().getTable() != null))
            this.getRecord().getTable().addListener((FieldListener)listener, this);   // Give the table a chance to clone this or whatever.
        else
            this.doAddListener((FieldListener)listener);
    }
969438
public synchronized void addListener(AuthListener listener) {
        if (getListeners().contains(listener)){
            return;
        }
        mListeners.add(new WeakReference<>(listener));
    }
453162
@RequiresPermission(Manifest.permission.ACCESS_NETWORK_STATE)
    public static void register(@NonNull Context context, @NonNull ConnectivityListener listener) {
        if (receiversMap.containsKey(listener)) {
            throw new RuntimeException("Connectivity listener " + listener
                    + " is already registered");
        }

        final ConnectivityReceiver receiver = new ConnectivityReceiver(listener);
        receiversMap.put(listener, receiver);
        context.registerReceiver(receiver,
                new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
        receiver.notify(isConnected(context));
    }
256642
public function addListener($eventName, $listener, $priority = 0)
    {
        $this->getDispatcher()->addListener($eventName, $listener, $priority);
    }
163028
public void registerListener(IPluginEventListener listener) {
        if (pluginEventListeners2 == null) {
            pluginEventListeners2 = new ArrayList<>();
        }

        if (!pluginEventListeners2.contains(listener)) {
            pluginEventListeners2.add(listener);
            listener.onPluginEvent(new PluginEvent(this, PluginAction.SUBSCRIBE));
        }
    }
1352779
public void registerListener(ConfigurationListener<T> listener) {
        Util.notNull(listener, "Configuration listener");
        listeners.add(listener);
    }
188570
public static void registerListener(Context context, PlaybackListener listener) {
        IntentFilter filter = new IntentFilter();
        filter.addAction(PlaybackListener.ACTION_ON_TRACK_PLAYED);
        filter.addAction(PlaybackListener.ACTION_ON_PLAYER_PAUSED);
        filter.addAction(PlaybackListener.ACTION_ON_SEEK_COMPLETE);
        filter.addAction(PlaybackListener.ACTION_ON_PLAYER_DESTROYED);
        filter.addAction(PlaybackListener.ACTION_ON_BUFFERING_STARTED);
        filter.addAction(PlaybackListener.ACTION_ON_BUFFERING_ENDED);
        filter.addAction(PlaybackListener.ACTION_ON_PROGRESS_CHANGED);

        LocalBroadcastManager.getInstance(context.getApplicationContext())
                .registerReceiver(listener, filter);
    }
1089075
protected boolean register(IEventListener listener) {
        log.debug("register - listener: {}", listener);
        boolean registered = listeners.add(listener);
        if (registered) {
            listenerStats.increment();
            // prepare response for new client
            ownerMessage.addEvent(Type.CLIENT_INITIAL_DATA, null, null);
            if (!isPersistent()) {
                ownerMessage.addEvent(Type.CLIENT_CLEAR_DATA, null, null);
            }
            if (!attributes.isEmpty()) {
                ownerMessage.addEvent(new SharedObjectEvent(Type.CLIENT_UPDATE_DATA, null, getAttributes()));
            }
            // we call notifyModified here to send response if we're not in a beginUpdate block
            notifyModified();
        }
        return registered;
    }
801636
@ObjectiveCName("subscribeWithListener:notify:")
    public void subscribe(ValueChangedListener<T> listener, boolean notify) {
        // im.actor.runtime.Runtime.checkMainThread();

        if (listeners.contains(listener)) {
            return;
        }
        listeners.add(listener);
        if (notify) {
            listener.onChanged(get(), this);
        }
    }
381946
public void addListener(AnimatorListener listener) {
        if (mListeners == null) {
            mListeners = new ArrayList<AnimatorListener>();
        }
        mListeners.add(listener);
    }
130771
protected final <T extends EventListener> void addListener(Class<T> listenerType, T listener) {
		if (this.listeners == null) {
			this.listeners = new ListenerCollection<>();
		}
		this.listeners.add(listenerType, listener);
	}
573511
public final synchronized void add(String name, L listener) {
        if (this.map == null) {
            this.map = new HashMap<>();
        }
        L[] array = this.map.get(name);
        int size = (array != null)
                ? array.length
                : 0;

        L[] clone = newArray(size + 1);
        clone[size] = listener;
        if (array != null) {
            System.arraycopy(array, 0, clone, 0, size);
        }
        this.map.put(name, clone);
    }
1321757
@Override
    public void subscribeRemoteEvent(String eventName, boolean subscribe) {
        String channelName = EventUtil.getChannelName(eventName);
        
        if (subscribe) {
            consumer.subscribe(channelName, this);
        } else {
            consumer.unsubscribe(channelName, this);
        }
    }