public boolean process(TProtocol iprot, TProtocol oprot) throws TException { /* 先读取消息头 */ TMessage message = iprot.readMessageBegin(); if (message.type != TMessageType.CALL && message.type != TMessageType.ONEWAY) { // TODO Apache Guys - Can the server ever get an EXCEPTION or REPLY? // TODO Should we check for this here? throw new TException("This should not have happened!?"); } // Extract the service name int index = message.name.indexOf(TMultiplexedProtocol.SEPARATOR); if (index < 0) { throw new TException("Service name not found in message name: " + message.name + ". Did you " + "forget to use a TMultiplexProtocol in your client?"); } // 从message中读取serviceName String serviceName = message.name.substring(0, index); TProcessor actualProcessor = SERVICE_PROCESSOR_MAP.get(serviceName); if (actualProcessor == null) { throw new TException("Service name not found: " + serviceName + ". Did you forget " + "to call registerProcessor()?"); } // Create a new TMessage, removing the service name TMessage standardMessage = new TMessage( message.name.substring(serviceName.length()+TMultiplexedProtocol.SEPARATOR.length()), message.type, message.seqid ); //由真实的处理器对输入信息进行处理 return actualProcessor.process(new StoredMessageProtocol(iprot, standardMessage), oprot); }