Register a listener for a service, using a filter expression.
@param listener the listener callback object to register
@param filter a filter expression matching a service
357006
@Override
    public void addServiceListener(ServiceListener listener, String filter) throws InvalidSyntaxException {
        if (null == filteredServiceListeners.get(filter)) {
            filteredServiceListeners.put(filter, new ArrayList<ServiceListener>(1));
        }

        filteredServiceListeners.get(filter).add(listener);
    }
472586
function registerListener(context, listener, ...arg) {
    if (context.set) {
        for (let i = 0; i < arg.length; i++) {
            if (isFunction(arg[i])) {
                listener.push(arg[i]);
            }
        }
    }
    return context;
}
498174
@Override
    public void registerService(ServiceInstance<T> service) throws Exception
    {
        Entry<T> newEntry = new Entry<T>(service);
        Entry<T> oldEntry = services.putIfAbsent(service.getId(), newEntry);
        Entry<T> useEntry = (oldEntry != null) ? oldEntry : newEntry;
        synchronized(useEntry)
        {
            if ( useEntry == newEntry ) // i.e. is new
            {
                useEntry.cache = makeNodeCache(service);
            }
            internalRegisterService(service);
        }
    }
505691
private static BroadcastReceiver registerBroadcastReceiverInternal(final Context context,
                                                                       final String action, final BroadcastReceiver receiver) {
        if (receiver == null) {
            return null;
        }

        IntentFilter filter = new IntentFilter(action);
        context.registerReceiver(receiver, filter);
        return receiver;
    }
864404
public void registerService(Object service)
    {
    	this.setService(service);
    	String serviceClass = getInterfaceClassName(); 

    	if (service != null)
    		serviceRegistration = context.registerService(serviceClass, this.service, properties);
    }
883152
def add_serviceListener(self, type, listener):
        """"""
        self.remove_service_listener(listener)
        self.browsers.append(ServiceBrowser(self, type, listener))
1063449
public function register($eventType, callable $filter)
    {
        if (!isset($this->handlers[$eventType])) {
            $this->handlers[$eventType] = [];
        }

        $this->handlers[$eventType][] = $filter;
    }
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));
        }
    }
1036545
@Override
    public void setFilter(Service.Filter filter) {
        _filter = _filter == null ? filter : new CompoundServiceFilter(filter, _filter);
    }
573278
public static <T> void register(final Class<T> service) {
        for (T each : ServiceLoader.load(service)) {
            registerServiceClass(service, each);
        }
    }
625311
private void postRoutedServerNotificationListenerRegistrationEvent(String operation, NotificationTargetInformation nti, ObjectName listener,
                                                                       NotificationFilter filter, Object handback) {
        Map<String, Object> props = createServerListenerRegistrationEvent(operation, nti, listener, filter, handback);
        safePostEvent(new Event(REGISTER_JMX_NOTIFICATION_LISTENER_TOPIC, props));
    }
1045575
public void add(Listener listener) {
        logger.trace("Adding listener [{}]", listener);
        synchronized (listeners) {
            listeners.add(listener);
        }
    }
1369422
public void setFilter(Filter filter)
    {
        if (this.filter == null)
        {
            this.filter = new FilterList();
        }
        if (filter != null)
        {
            this.filter.addFilter(filter);
        }
    }
1129346
public void registerListener(RetryListener listener) {
		List<RetryListener> list = new ArrayList<RetryListener>(
				Arrays.asList(this.listeners));
		list.add(listener);
		this.listeners = list.toArray(new RetryListener[list.size()]);
	}
1182419
public synchronized void addListener(CollectionProxyListener listener)
    {
        if (_listeners == null)
        {
            _listeners = new ArrayList();
        }
        // to avoid multi-add of same listener, do check
        if(!_listeners.contains(listener))
        {
            _listeners.add(listener);
        }
    }
822893
@SuppressWarnings({ "unchecked", "rawtypes" })
	protected void registerLayerListener() {
		Dictionary dict = new Properties();
		dict.put("name", getName()); //$NON-NLS-1$
		registrations.add(getPlatformServices().registerService(
				ILayerListener.class.getName(), new AggregatorLayerListener(this), dict));
	}
470918
public void registerProcessForMessage(BaseMessageFilter messageFilter, String strProcessClass, Map<String,Object> properties)
    {
        new TrxMessageListener(messageFilter, (Application)this.getTask().getApplication(), strProcessClass, properties);   // This listener was added to the filter
        ((MessageInfoApplication)this.getTask().getApplication()).getThickMessageManager().addMessageFilter(messageFilter);
        // Note: No need to worry about cleanup... Freeing the message manager will free all these listeners.
        if (properties != null)
            if (properties.get(MessageInfoApplication.AUTOSTART) != null)
                ((MessageInfoApplication)this.getTask().getApplication()).getThickMessageManager().sendMessage(new MapMessage(new BaseMessageHeader(messageFilter.getQueueName(), messageFilter.getQueueType(), this, null), properties));
    }