Registering custom dispatcher

@param dispatcherId dispatcher id
@param dispatcher   dispatcher object
325159
public void addDispatcher(String dispatcherId, AbsActorDispatcher dispatcher) {
        synchronized (dispatchers) {
            if (dispatchers.containsKey(dispatcherId)) {
                return;
            }
            dispatchers.put(dispatcherId, dispatcher);
        }
    }
424525
public function register()
    {
        $this->app->singleton(Dispatcher::class, function (Container $app) {
            return new Dispatcher($app, function ($connection = null) use ($app) {
                return $app->make(Factory::class)->connection($connection);
            });
        });

        $this->app->alias(Dispatcher::class, DispatcherContract::class);
        $this->app->alias(Dispatcher::class, QueueingDispatcherContract::class);
    }
119426
public <T extends InvocationMarshaller<?>> T registerDispatcher (
        InvocationDispatcher<T> dispatcher)
    {
        return registerDispatcher(dispatcher, null);
    }
1347688
@Handler(channels = Self.class)
    public void onRegistered(NioRegistration.Completed event)
            throws InterruptedException, IOException {
        NioHandler handler = event.event().handler();
        if (!(handler instanceof TcpChannelImpl)) {
            return;
        }
        if (event.event().get() == null) {
            fire(new Error(event, "Registration failed, no NioDispatcher?",
                new Throwable()));
            return;
        }
        TcpChannelImpl channel = (TcpChannelImpl) handler;
        channel.registrationComplete(event.event());
        channel.downPipeline()
            .fire(new Connected(channel.nioChannel().getLocalAddress(),
                channel.nioChannel().getRemoteAddress()), channel);
    }
1366093
public void register(FoxHttpInterceptorType interceptorType, FoxHttpInterceptor foxHttpInterceptor) throws FoxHttpException {
        FoxHttpInterceptorType.verifyInterceptor(interceptorType, foxHttpInterceptor);
        if (foxHttpInterceptors.containsKey(interceptorType)) {
            foxHttpInterceptors.get(interceptorType).add(foxHttpInterceptor);
        } else {
            foxHttpInterceptors.put(interceptorType, new ArrayList<>(Arrays.asList(foxHttpInterceptor)));
        }
    }
381667
public void registerLoaderIndicators(By... loaderIndicators) {
    	for(By locator : loaderIndicators) {
    		log.debug("Registered loader: " + locator);
    		this.expectedGlobalConditions.add(new ExpectedWebElementCondition(locator));
    	}
    }
624030
function (dispatcher) {

    if (dispatchers.isDispatcher(dispatcher)) {
      this.dispatcher = dispatcher;
    } else {
      this.dispatcher = new dispatchers.Dispatcher();
    }

    this.tokens = [];

    this.resetProps();
    this.resetState();

    var name = this.constructor.name;
    var trace;
    var handler;

    if (factory.isFunction(this.storeWillMount)) {
      trace = new Error(name + ': storeWillMount handler error');
      handler = this.catchError(this.storeWillMount.bind(this), trace);
      this.on('storeWillMount', handler);
    }

    if (factory.isFunction(this.storeWillUnmount)) {
      trace = new Error(name + ': storeWillUnmount handler error');
      handler = this.catchError(this.storeWillUnmount.bind(this), trace);
      this.on('storeWillUnmount', handler);
    }

    if (factory.isFunction(this.storeWillReceiveProps)) {
      trace = new Error(name + ': storeWillReceiveProps handler error');
      handler = this.catchError(this.storeWillReceiveProps.bind(this), trace);
      this.on('storeWillReceiveProps', handler);
    }
  }
1281167
protected final void registerBrowser( AbstractQueueBrowser browser )
    {
    	if (browsersMap.put(browser.getId(),browser) != null)
    		throw new IllegalArgumentException("Browser "+browser.getId()+" already exists");
    }
935455
function Dispatcher(req, res, next) {
            _classCallCheck(this, Dispatcher);

            this.req = req;
            this.res = res;
            this.next = next;
         }
747084
function (dispatcher) {

    if (dispatchers.isDispatcher(dispatcher)) {
      this.dispatcher = dispatcher;
    } else {
      this.dispatcher = new dispatchers.Dispatcher();
    }

    var action = this;
    var prototype = Object.getPrototypeOf(this);
    Object.keys(prototype).forEach(function (method) {
      if (method !== 'dispatch') {
        action[method] = function () {
          var ret = prototype[method].apply(action, arguments);
          if (typeof ret !== 'undefined') {
            action.dispatch(ret);
          }
        };
      }
    });
  }
1020016
function (callback) {
      var trace = new Error(this.constructor.name + ': dispatcher handler error');
      var token = this.dispatcher.register(this.catchError(callback, trace));
      this.tokens.push(token);
    }
504565
public void registerCallback(String importer, ChannelChangeCallback callback) {
        Preconditions.checkArgument(
                importer != null && !importer.trim().isEmpty(),
                "importer is null or empty"
                );
        callback = checkNotNull(callback, "callback is null");

        if (m_done.get()) return;

        int [] stamp = new int[]{0};
        NavigableMap<String,ChannelChangeCallback> prev = null;
        NavigableMap<String,ChannelChangeCallback> next = null;
        ImmutableSortedMap.Builder<String,ChannelChangeCallback> mbldr = null;

        synchronized (m_undispatched) {
            do {
                prev = m_callbacks.get(stamp);
                mbldr = ImmutableSortedMap.naturalOrder();
                mbldr.putAll(Maps.filterKeys(prev, not(equalTo(importer))));
                mbldr.put(importer, callback);
                next = mbldr.build();
            } while (!m_callbacks.compareAndSet(prev, next, stamp[0], stamp[0]+1));

            NavigableSet<String> registered = next.navigableKeySet();
            NavigableSet<String> unregistered = m_unregistered.getReference();

            Iterator<ImporterChannelAssignment> itr = m_undispatched.iterator();
            while (itr.hasNext()) {
                final ImporterChannelAssignment assignment = itr.next();
                if (registered.contains(assignment.getImporter())) {
                    final ChannelChangeCallback dispatch = next.get(assignment.getImporter());
                    m_buses.submit(new DistributerRunnable() {
                        @Override
                        public void susceptibleRun() throws Exception {
                            dispatch.onChange(assignment);
                        }
                    });
                    itr.remove();
                } else if (unregistered.contains(assignment.getImporter())) {
                    itr.remove();
                    if (!assignment.getAdded().isEmpty()) {
                        LOG.warn("(" + m_hostId
                                + ") discarding assignment to unregistered importer "
                                + assignment);
                    }
                }
            }
        }
    }
798299
protected void register(final Class<? extends Component<?>> interfaceClass, final Class<? extends Component<?>> implClass, final PriorityLevel priority) {
        register(interfaceClass, implClass, priority, 0);
    }
774055
public function register(IURLDispatcher $dispatcher, $index = 10) {
        $this->dispatchers [ $index ] [] = $dispatcher;
        ksort($this->dispatchers, SORT_NUMERIC);
    }
27014
@Override
    public void registerControlAdapters()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "registerControlAdapters");

        //register the local queue point/publication point as appropriate
        _protoRealization.registerControlAdapters();

        // If _remoteQueuePoints not null indicates Queue destination
        SIMPIterator itr = null;
        if (_remoteQueuePoints != null)
        {
            //register the xmit queue points
            itr = _remoteQueuePoints.iterator();
            while (itr.hasNext())
            {
                ControlAdapter remote = (ControlAdapter) itr.next();
                remote.registerControlAdapterAsMBean();
            }
            itr.finished();
        }

        if (isLink())
        {
            //register the xmit queue points
            Iterator it = _localisationManager.getXmitQueueIterator();
            while (it.hasNext())
            {
                ControlAdapter remote = ((PtoPXmitMsgsItemStream) it.next()).getControlAdapter();
                remote.registerControlAdapterAsMBean();
            }
        }

        //We're not registering the BDH's control handler at this time
        // But we register the link as a SIBLink MBean
        if (isLink())
            getControlAdapter().registerControlAdapterAsMBean();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "registerControlAdapters");
    }
174986
@Override
    public synchronized void dispatch(@NonNull Event event) {
        String type = event.type;
        List<EventHandlerWrapper> eventHandlers = subscribers.get(type);
        if (eventHandlers != null) {
            EventHandlerWrapper handler = null;
            for (int i = 0, size = eventHandlers.size(); i < size; i++) {
                handler = eventHandlers.get(i);
                if (handler.eventHandlerReceiver != null) {
                    handler.handleEvent(event);
                } else {
                    if (!TextUtils.isEmpty(handler.producer) && handler.producer.equals(event.sourceId)
                            || TextUtils.isEmpty(handler.producer)) {
                        handler.handleEvent(event);
                    }
                }
            }
        }
    }
234320
def register(dispatcher, func, *, hook=None):
    
    wrapper = None
    if isinstance(func, (classmethod, staticmethod)):
        wrapper = type(func)
        func = func.__func__
    ensure_function(func)
    if isinstance(dispatcher, (classmethod, staticmethod)):
        wrapper = None
    dp = unwrap(dispatcher)
    try:
        dp.__functions
    except AttributeError:
        raise OverloadingError("%r has not been set up as an overloaded function." % dispatcher)
    fn = unwrap(func)
    if hook:
        dp.__hooks[hook] = func
    else:
        signature = get_signature(fn)
        for i, type_ in enumerate(signature.types):
            if not isinstance(type_, type):
                raise OverloadingError(
                  "Failed to overload function '{0}': parameter '{1}' has "
                  "an annotation that is not a type."
                  .format(dp.__name__, signature.parameters[i]))
        for fninfo in dp.__functions:
            dup_sig = sig_cmp(signature, fninfo.signature)
            if dup_sig and signature.has_varargs == fninfo.signature.has_varargs:
                raise OverloadingError(
                  "Failed to overload function '{0}': non-unique signature ({1})."
                  .format(dp.__name__, str.join(', ', (_repr(t) for t in dup_sig))))
        # All clear; register the function.
        dp.__functions.append(FunctionInfo(func, signature))
        dp.__cache.clear()
        dp.__maxlen = max(dp.__maxlen, len(signature.parameters))
        if typing:
            # For each parameter position and name, compute a bitwise union of complexity
            # values over all registered signatures. Retain the result for parameters where
            # a nonzero value occurs at least twice and at least one of those values is >= 2.
            # Such parameters require deep type-checking during function resolution.
            position_values = defaultdict(lambda: 0)
            keyword_values = defaultdict(lambda: 0)
            position_counter = Counter()
            keyword_counter = Counter()
            for fninfo in dp.__functions:
                sig = fninfo.signature
                complex_positions = {i: v for i, v in enumerate(sig.complexity) if v}
                complex_keywords = {p: v for p, v in zip(sig.parameters, sig.complexity) if v}
                for i, v in complex_positions.items():
                    position_values[i] |= v
                for p, v in complex_keywords.items():
                    keyword_values[p] |= v
                position_counter.update(complex_positions.keys())
                keyword_counter.update(complex_keywords.keys())
            dp.__complex_positions = {
                i: v for i, v in position_values.items() if v >= 2 and position_counter[i] > 1}
            dp.__complex_parameters = {
                p: v for p, v in keyword_values.items() if v >= 2 and keyword_counter[p] > 1}
    if wrapper is None:
        wrapper = lambda x: x
    if func.__name__ == dp.__name__:
        # The returned function is going to be bound to the invocation name
        # in the calling scope, so keep returning the dispatcher.
        return wrapper(dispatcher)
    else:
        return wrapper(func)