Inject the internal WsMessageRouter.
506114
protected void setWsMessageRouter(WsMessageRouter msgRouter) {
        internalMessageRouter.set(msgRouter);

        // Pass the earlierMessages queue to the router.
        // Now that the internalMessageRouter is non-null, this class will
        // NOT add any more messages to the earlierMessages queue.
        // The MessageRouter basically owns the earlierMessages queue
        // from now on.

        if (earlierMessages != null) {
            synchronized (this) {
                if (earlierMessages != null) {
                    msgRouter.setEarlierMessages(earlierMessages);
                }
            }
        } else {
            msgRouter.setEarlierMessages(null);
        }
    }
221150
def _init_handler(self, session, reader, writer):
        
        handler = BrokerProtocolHandler(self.plugins_manager, self._loop)
        handler.attach(session, reader, writer)
        return handler
1152548
protected void internalMessageHandler(DirectBuffer buffer, int offset, int length, Header header) {
        /**
         * All incoming internal messages are either op commands, or aggregation messages that are tied to commands
         */
        byte[] data = new byte[length];
        buffer.getBytes(offset, data);

        VoidMessage message = VoidMessage.fromBytes(data);

        messages.add(message);

        //    log.info("internalMessageHandler message request incoming: {}", message.getClass().getSimpleName());
    }
994920
public Mono<ServiceMessage> invokeOne(
      ServiceMessage message, BiFunction<ServiceMessage, Class<?>, ServiceMessage> dataDecoder) {
    return Mono.defer(() -> Mono.from(invoke(toRequest(message, dataDecoder))))
        .map(this::toResponse)
        .onErrorResume(throwable -> Mono.just(errorMapper.toMessage(throwable)));
  }
1058599
public void inject(final Object target) {
        if (uiThreadRunner.isOnUiThread()) {
            try {
                graph.inject(target, Inject.class);
            } catch (PokeException e) {
                throw new MvcGraphException(e.getMessage(), e);
            }
        } else {
            uiThreadRunner.post(new Runnable() {
                @Override
                public void run() {
                    try {
                        graph.inject(target, Inject.class);
                    } catch (PokeException e) {
                        throw new MvcGraphException(e.getMessage(), e);
                    }
                }
            });
        }
    }
1030904
def inject(**bindings):
    

    def outer_wrapper(f):
        def function_wrapper(ff):
            for key, value in viewitems(bindings):
                bindings[key] = BindingKey(value)

            @functools.wraps(ff)
            def _inject(*args, **kwargs):
                inj = get_current_app().injector
                dependencies = inj.args_to_inject(
                    function=ff,
                    bindings=bindings,
                    owner_key=ff
                )
                dependencies.update(kwargs)
                try:
                    return ff(*args, **dependencies)
                except TypeError as e:
                    reraise(e, CallError(ff, args, dependencies, e))

            return _inject

        '''
        Just a convenience method - delegates everything to wrapper.
        '''

        def method_or_class_wrapper(*a, **kwargs):
            """
            Properly installs the injector into the object so that the injection can be performed.
            """
            inj = get_current_app().injector
            # Install injector into the self instance if this is a method call.
            inj.install_into(a[0])

            # Use the generic wrapper.
            inject_f = injector.inject(**bindings)
            # Call the method.
            return inject_f(f)(*a, **kwargs)

        if inspect.ismethod(f):
            return method_or_class_wrapper
        else:
            return function_wrapper(f)

    return outer_wrapper
383585
def wrap_handler(cls, handler, protocol, **kwargs):
        '''  '''
        def _wrapper(request, *args, **kwargs):
            instance = cls(request=request, **kwargs)
            if protocol == Resource.Protocol.http:
                return instance._wrap_http(handler, request=request, **kwargs)
            elif protocol == Resource.Protocol.websocket:
                return instance._wrap_ws(handler, request=request, **kwargs)
            elif protocol == Resource.Protocol.amqp:
                return instance._wrap_amqp(view_type, *args, **kwargs)
            else:
                raise Exception('Communication protocol not specified')
        return _wrapper
1185528
public synchronized void enable() {
        ServiceDiscoveryManager.getInstanceFor(connection()).addFeature(NAMESPACE);
        StanzaFilter filter = new AndFilter(OUTGOING_FILTER, new NotFilter(OUTGOING_FILTER));
        connection().addStanzaInterceptor(ADD_ORIGIN_ID_INTERCEPTOR, filter);
    }
268949
function (less, pluginManager) {
        var injector = this.getInstance(less);

        // only auto inject after 2.4.0
        if (pluginManager.addPreProcessor) {
            pluginManager.addPreProcessor(injector);
        }
    }
1034701
@Override
    public void writeRemoteObject(OutputStream out, @Sensitive Object obj) throws org.omg.CORBA.SystemException {
        WSUtilService service = WSUtilService.getInstance();
        if (service != null) {
            obj = service.replaceObject(obj);
        }
        super.writeRemoteObject(out, obj);
    }
324514
def _run_internal(self,
                    context,
                    pipeline_key,
                    root_pipeline_key,
                    caller_output):
    """"""
    self._set_values_internal(
        context, pipeline_key, root_pipeline_key, caller_output,
        _PipelineRecord.RUN)
    logging.debug('Running %s(*%s, **%s)#%s',
                  self._class_path, _short_repr(self.args),
                  _short_repr(self.kwargs), self._pipeline_key.name())
    return self.run(*self.args, **self.kwargs)
850365
def run(self):
        
        self.api = self.context.get("cls")(self.context)
        self.context["inst"].append(self)  # Adapters used by strategies

        def on_ws_connect(*args, **kwargs):
            """Callback on connect hook to set is_connected_ws"""
            self.is_connected_ws = True
            self.api.on_ws_connect(*args, **kwargs)

        # Initialize websocket in a thread with channels
        if hasattr(self.api, "on_ws_connect"):
            self.thread = Process(target=self.api.connect_ws, args=(
                on_ws_connect, [
                    SockChannel(channel, res_type, self._generate_result)
                    for channel, res_type in
                    self
                    .context
                    .get("conf")
                    .get("subscriptions")
                    .items()
                ]))
            self.thread.start()
333496
function sendClientConsoleMessage(ws, message) {
  var msg = JSON.stringify({
    custom: {
      console: message
    }
  });
  ws.write(msg);
}
396402
def inject_nmi(self):
        
        sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID)
        if sushy_system.power_state != sushy.SYSTEM_POWER_STATE_ON:
            raise exception.IloError("Server is not in powered on state.")

        try:
            sushy_system.reset_system(sushy.RESET_NMI)
        except sushy.exceptions.SushyError as e:
            msg = (self._('The Redfish controller failed to inject nmi to '
                          'server. Error %(error)s') % {'error': str(e)})
            LOG.debug(msg)
            raise exception.IloError(msg)
870955
protected void __internalBuild() {
        w_ = null; // reset output destination
        try {
            long l = 0l;
            if (__logTime()) {
                l = System.currentTimeMillis();
            }
            final String code = secureCode;
            Sandbox.enterRestrictedZone(code);
            try {
                __internalInit();
                build();
            } finally {
                __finally();
                Sandbox.leaveCurZone(code);
            }
            if (__logTime()) {
                __logger.debug("<<<<<<<<<<<< [%s] build: %sms", getClass().getName(), System.currentTimeMillis() - l);
            }
        } catch (RythmException e) {
            throw e;
        } catch (Throwable e) {
            handleThrowable(e);
        }
        if (null != w_) {
            try {
                IO.writeContent(toString(), w_);
                w_ = null;
            } catch (Exception e) {
                Logger.error(e, "failed to write template content to output destination");
            }
        }
    }
631308
private void installLexicalHandler ()
    {
        XMLReader parent = getParent();
        if (parent == null) {
            throw new NullPointerException("No parent for filter");
        }
        // try to register for lexical events
        for (int i = 0; i < LEXICAL_HANDLER_NAMES.length; i++) {
            try {
                parent.setProperty(LEXICAL_HANDLER_NAMES[i], this);
                break;
            }
            catch (SAXNotRecognizedException ex) {
                // ignore
            }
            catch (SAXNotSupportedException ex) {
                // ignore
            }
        }
    }
200810
private static void injectExplicitly(Injector.Configuration config) {
		
		ExplicitInjectors.APPLICATION.inject(config);
		ExplicitInjectors.RESOURCES.inject(config);
		ExplicitInjectors.SYSTEM_SERVICES.inject(config);
		ExplicitInjectors.ICKLE_SERVICES.inject(config);
		ExplicitInjectors.POJOS.inject(config);
	}