消息处理

@param channel
@param message
977197
@Override
    public void onMessage(String channel, String message) {
        LoglevelCommand loglevelCommand = Json.fromJson(LoglevelCommand.class, message);
        //通过实例名称更改日志等级 或 通过进程ID更改日志等级
        if (("name".equals(loglevelCommand.getAction())
                && Strings.sNull(loglevelCommand.getName()).equals(loglevelProperty.getName())) ||
                ("processId".equals(loglevelCommand.getAction()) && Strings.sNull(loglevelCommand.getProcessId()).equals(loglevelProperty.getProcessId()))) {
            //更改之前
            System.out.println("logback loglevel change start.");
            testLevel();
            if (Strings.isNotBlank(loglevelCommand.getLevel())) {
                setLevel(loglevelCommand.getLevel());
                saveToRedis();
            }
            System.out.println("----------------------------");
            //更改之后
            testLevel();
            System.out.println("logback loglevel change end.");
        }
    }
594201
public void sendMessage(String message) {
        EventBuilder eventBuilder = new EventBuilder().withMessage(message)
            .withLevel(Event.Level.INFO);
        sendEvent(eventBuilder);
    }
199201
protected void addMessage(String message)
    {
        messages.add(message);
        messageCount++;
        if (messageCount > messagesQueueMax)
        {
            messages.remove();
            messageCount--;
        }
    }
1211719
public void error(Object message) {
        doLog(Level.ERROR, FQCN, message, null, null);
    }
134083
void release(final Channel channel) {
        if (this.executor.inEventLoop()) {
            this.releaseWithinEventExecutor(channel);
        } else {
            this.executor.submit(new Runnable() {
                @Override
                public void run() {
                    ApnsChannelPool.this.releaseWithinEventExecutor(channel);
                }
            });
        }
    }
880359
public static void message(String message, Throwable e) {
    if(message == null && e != null) {
      message = e.getMessage();
    }
    logExpensive(Level.INFO, message, e);
  }
1019443
function onMessage(message) {
    if (done) return
    if (message.type != "utf8") return sendConnectFailed(wsConn)

    try {
      message = JSON.parse(message.utf8Data)
    }
    catch(err) {
      return sendConnectFailed(wsConn)
    }

    var id  = message.id

    if (message.type != "request") return sendConnectFailed(wsConn)
    if (message.name != "connect") return sendConnectFailed(wsConn)
    if (message.to   != "server") return sendConnectFailed(wsConn)

    var body = message.body || {}

    if (!body.key) return sendConnectFailed(wsConn)

    var session = sessions.getSession(body.key)
    var channel = channels.createChannel(session, wsConn)

    message = {
      type: "response",
      name: "connect",
      from: "server",
      id:   message.id,
      body: null
    }

    wsConn.sendUTF(JSON.stringify(message))
    cleanUp()
  }
1360666
function onMessage(message) {

    if (!session._channel) {
      DEBUG("channel connection message received")
      if (message.type != "response") return
      if (message.name != "connect") return
      if (message.from != "server") return
      if (message.id   != "0") return

      DEBUG("channel connection message accepted")

      session._channel = channel
      cb(null, session)
      return
    }

    var agent

    if (message.to == "server") {
      if (message.type == "request")     agent = session._ragentServer
    }

    else if (message.from == "server") {
      if (message.type == "response")    agent = session._ragentServer
      if (message.type == "event")       agent = session._ragentServer
    }

    else if (message.type == "request")  agent = session._agents.get(message.to)
    else if (message.type == "response") agent = session._ragents.get(message.from)
    else if (message.type == "event")    agent = session._ragents.get(message.from)

    if (!agent) return

    if      (message.type == "request")  agent._onRequest(message)
    else if (message.type == "response") agent._onResponse(message)
    else if (message.type == "event")    agent._onEvent(message)
  }
680680
public boolean sendMessage(SocketChannel channel, Message message) {
    return sendResponse(REQID.zeroREQID, channel, message);
  }
141857
public static void toast(String message) {

        Toast toast = Toast.makeText(QuickUtils.getContext(), message, Toast.LENGTH_SHORT);
        toast.show();
    }
817855
public void onMessage(final byte[] message, final Session session) {
        final SynchronizeFXWebsocketChannel channel = getChannelOrFail(session);

        channel.newMessage(message, session);
    }
828801
public void setMessage(CharSequence message){
        if(mConstruct != null && !mConstruct.getDesign().isMaterial()){
            TextView msgView = (TextView) getDialog().findViewById(R.id.message);
            msgView.setText(message);
        }else{
            if(mMessage != null){
                mMessage.setText(message);
            }
        }
    }
852144
public void error(final String message) {
        messages.add(new LogMessage(message, LogMessage.Type.ERROR));
        log.error(message);
    }
645246
public static ChannelUDT channelUDT(final Channel channel) {
        // bytes
        if (channel instanceof NioUdtByteAcceptorChannel) {
            return ((NioUdtByteAcceptorChannel) channel).javaChannel();
        }
        if (channel instanceof NioUdtByteRendezvousChannel) {
            return ((NioUdtByteRendezvousChannel) channel).javaChannel();
        }
        if (channel instanceof NioUdtByteConnectorChannel) {
            return ((NioUdtByteConnectorChannel) channel).javaChannel();
        }

        // message
        if (channel instanceof NioUdtMessageAcceptorChannel) {
            return ((NioUdtMessageAcceptorChannel) channel).javaChannel();
        }
        if (channel instanceof NioUdtMessageRendezvousChannel) {
            return ((NioUdtMessageRendezvousChannel) channel).javaChannel();
        }
        if (channel instanceof NioUdtMessageConnectorChannel) {
            return ((NioUdtMessageConnectorChannel) channel).javaChannel();
        }

        return null;
    }
132065
protected void sendInfoPacket(String channel) {
		Tree msg = registry.getDescriptor();
		msg.put("ver", PROTOCOL_VERSION);
		msg.put("sender", nodeID);
		msg.put("seq", registry.getTimestamp());
		publish(channel, msg);
	}
1362335
public static void closeConnection( Channel channel ) throws IOException {

		if( channel != null ) {
			if( channel.isOpen())
				channel.close();

			if( channel.getConnection().isOpen())
				channel.getConnection().close();
		}
	}
781412
public int sendMessage(Message message)
    {
        BaseMessageHeader messageHeader = ((BaseMessage)message).getMessageHeader();
        String strQueueType = messageHeader.getQueueType();
        String strQueueName = messageHeader.getQueueName();
        MessageSender sender = this.getMessageQueue(strQueueName, strQueueType).getMessageSender();
        if (sender != null)
            sender.sendMessage(message);
        else
            return Constant.ERROR_RETURN;  // Queue doesn't exist
        return Constant.NORMAL_RETURN;
    }