Registers a {@link MessageHandler} that handles the received messages of
the specified <code>type</code>.

@return the old handler if there is already a registered handler for
the specified <tt>type</tt>.  <tt>null</tt> otherwise.
1391
@SuppressWarnings("unchecked")
    public <E> MessageHandler<? super E> addReceivedMessageHandler(Class<E> type,
            MessageHandler<? super E> handler) {
        receivedMessageHandlerCache.clear();
        return (MessageHandler<? super E>) receivedMessageHandlers.put(type, handler);
    }
1229247
void addMessageHandler(SubscriptionMessageHandler messageHandler)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "addMessageHandler", messageHandler);

    final boolean inserted = _subscriptionMessagePool.add(messageHandler);
    // If the message wasn't inserted, then the pool was exceeded
    if (!inserted)
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(
          tc,
         "SubscriptionObjectPool size exceeded");

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "addMessageHandler");
  }
276351
def add_handler(self, message_type, handler):
        """"""
        if message_type not in self._handlers:
            self._handlers[message_type] = []

        if handler not in self._handlers[message_type]:
            self._handlers[message_type].append(handler)
405720
public static MessageHandler signallingMessageHandler(final ProcessEngine processEngine) {
        return new MessageHandler() {
            @Override
            public void handleMessage(Message<?> message) throws MessagingException {
                String executionId = message.getHeaders().containsKey("executionId") ?
                        (String) message.getHeaders().get("executionId") : (String) null;

                if (null != executionId)
                    processEngine.getRuntimeService().trigger(executionId);
            }
        };
    }
1058479
public B handler(ChannelHandler handler) {
        if (handler == null) {
            throw new NullPointerException("handler");
        }
        this.handler = handler;
        return self();
    }
1107455
SubscriptionMessageHandler getMessageHandler()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getMessageHandler");

    SubscriptionMessageHandler messageHandler =
      (SubscriptionMessageHandler) _subscriptionMessagePool.remove();

    if (messageHandler == null)
    {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(
          tc,
          "doProxySubscribeOp",
          "Creating a new Message Handler as none available");

      messageHandler = new SubscriptionMessageHandler(this);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getMessageHandler", messageHandler);

    return messageHandler;
  }
629164
public SendGridContentHandler register(final Class<? extends Content> clazz, final SendGridContentHandler handler) {
		if (handler == null) {
			throw new IllegalArgumentException("[handler] cannot be null");
		}
		if (clazz == null) {
			throw new IllegalArgumentException("[clazz] cannot be null");
		}

		LOG.debug("Registering content handler {} for content type {}", handler, clazz);
		return handlers.put(clazz, handler);
	}
281177
@Override
    public InputHandler getInputHandler(ProtocolType type, SIBUuid8 sourceMEUuid, JsMessage msg)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "getInputHandler",
                        new Object[] { type, sourceMEUuid, msg });

        InputHandler msgHandler = null;

        if (type == ProtocolType.UNICASTINPUT)
        {
            msgHandler = getInputHandler();
        }
        else if (type == ProtocolType.PUBSUBINPUT)
        {
            msgHandler = getInputHandler();
        }
        else if (type == ProtocolType.ANYCASTINPUT)
        {

            // For durable, AIHs are referenced by pseudo destination ID so check for that first
            SIBUuid12 destID = msg.getGuaranteedTargetDestinationDefinitionUUID();
            SIBUuid12 gatheringTargetDestUuid = msg.getGuaranteedGatheringTargetUUID();

            msgHandler = _protoRealization.
                            getRemoteSupport().
                            getAnycastInputHandlerByPseudoDestId(destID);

            // Otherwise, use the uuid of the sourceCellule ME to find the RCD to deliver the message. We assume that this
            // uuid corresponds to that used to choose the RCD initially, and that was used by the associated
            // AIH as the uuid of the DME to which it sent the request for the message.
            if (msgHandler == null)
                msgHandler = getAnycastInputHandler(sourceMEUuid, gatheringTargetDestUuid, true);
        }
        //else
        //{
        //unsupported protocol type
        //return null
        //}

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "getInputHandler", msgHandler);

        return msgHandler;
    }
754231
final void addHandler(final HttpHandler handler) {
    if (handler != null) {
      if (!eventHandlers.containsKey(handler.getUriSpecification().toLowerCase())) {
        eventHandlers.put(handler.getUriSpecification().toLowerCase(), handler);
      } else {
        LOG.log(Level.WARNING, "JettyHandler handle is already registered: {0} ", handler.getUriSpecification());
      }
    }
  }
656560
public <T> void addMessageHandler(Class<T> clazz, Whole<T> handler) {
        connLink.addMessageHandler(clazz, handler);
    }
806493
public final Set<MessageHandler> getHandlers() {
        Set<MessageHandler> msgHandlers = new HashSet<>();
        for (HandlerWrapper handler : handlers.values()) {
            msgHandlers.add(handler.getHandler());
        }
        return msgHandlers;
    }
1218777
private void addHandler(Handler handler, ClassLoader loader)
  {
    // handlers ordered by level
    ArrayList<Handler> handlers = new ArrayList<Handler>();

    handlers.add(handler);

    for (ClassLoader ptr = loader; ptr != null; ptr = ptr.getParent()) {
      Handler []localHandlers = _localHandlers.getLevel(ptr);

      if (localHandlers != null) {
        for (int i = 0; i < localHandlers.length; i++) {
          int p = handlers.indexOf(localHandlers[i]);

          if (p < 0) {
            handlers.add(localHandlers[i]);
          }
          else {
            Handler oldHandler = handlers.get(p);

            if (localHandlers[i].getLevel().intValue()
                < oldHandler.getLevel().intValue()) {
              handlers.set(p, localHandlers[i]);
            }
          }
        }
      }
    }

    Handler []newHandlers = new Handler[handlers.size()];
    handlers.toArray(newHandlers);
    
    if (loader == _systemClassLoader)
      loader = null;

    _localHandlers.set(newHandlers, loader);
  }
1057830
def RegisterMessageHandler(self, handler, lease_time, limit=1000):
    """"""
    self.UnregisterMessageHandler()

    self.handler_stop = False
    self.handler_thread = threading.Thread(
        name="message_handler",
        target=self._MessageHandlerLoop,
        args=(handler, lease_time, limit))
    self.handler_thread.daemon = True
    self.handler_thread.start()
370398
@SuppressWarnings("unchecked")
    public <E extends Throwable> 
    ExceptionHandler<? super E> addExceptionHandler(
            Class<E> type, ExceptionHandler<? super E> handler) {
        exceptionHandlerCache.clear();
        return (ExceptionHandler<? super E>) exceptionHandlers.put(type, handler);
    }
13136
@Override
  public <T, U extends T> AutoCloseable registerHandler(
      final Class<U> messageType, final EventHandler<RemoteMessage<T>> theHandler) {

    if (LOG.isLoggable(Level.FINE)) {
      LOG.log(Level.FINE, "RemoteManager: {0} messageType: {1} handler: {2}", new Object[] {
          this.name, messageType.getCanonicalName(), theHandler.getClass().getCanonicalName()});
    }

    return this.handlerContainer.registerHandler(messageType, theHandler);
  }
269749
public synchronized EventScope<T> register(final Class<? extends T> eventClass, final Object receiver,
			final Method handler) {

		this.registerInternal(receiver, handler, eventClass);
		return this;

	}
59162
public static <T> T findFirstNextByType(FaceletHandler nextHandler, Class<T> type)
    {
        if (type.isAssignableFrom(nextHandler.getClass()))
        {
            return (T)nextHandler;
        }
        else if (nextHandler instanceof javax.faces.view.facelets.CompositeFaceletHandler)
        {
            for (FaceletHandler handler :
                    ((javax.faces.view.facelets.CompositeFaceletHandler)nextHandler).getHandlers())
            {
                if (type.isAssignableFrom(handler.getClass()))
                {
                    return (T)handler;
                }
            }
        }
        return null;
    }