Object response = null;
Protocol protocol = null;
try {
protocol = context.getGaeaRequest().getProtocol();
RequestProtocol request = (RequestProtocol)protocol.getSdpEntity();
sbInvokerMsg.append("protocol version:");
sbInvokerMsg.append(protocol.getVersion());
sbInvokerMsg.append("\nfromIP:");
sbInvokerMsg.append(context.getChannel().getRemoteIP());
sbInvokerMsg.append("\nlookUP:");
sbInvokerMsg.append(request.getLookup());
sbInvokerMsg.append("\nmethodName:");
sbInvokerMsg.append(request.getMethodName());
sbInvokerMsg.append("\nparams:");
if(request.getParaKVList() != null){
for (KeyValuePair kv : request.getParaKVList()) {
if(kv != null) {
sbInvokerMsg.append("\n--key:");
sbInvokerMsg.append(kv.getKey());
sbInvokerMsg.append("\n--value:");
sbInvokerMsg.append(kv.getValue());
} else {
logger.error("KeyValuePair is null Lookup:" + request.getLookup() + "--MethodName:" + request.getMethodName());
}
}
}
logger.debug(sbInvokerMsg.toString());
logger.debug("begin get proxy factory");
// get local proxy
IProxyStub localProxy = Global.getSingleton().getProxyFactory().getProxy(request.getLookup());
logger.debug("proxyFactory.getProxy finish");
if (localProxy == null) {
ServiceFrameException sfe = new ServiceFrameException(
"method:ProxyHandle.invoke--msg:" + request.getLookup() + "." + request.getMethodName() + " not fond",
context.getChannel().getRemoteIP(),
context.getChannel().getLocalIP(),
request,
ErrorState.NotFoundServiceException,
null);
response = ExceptionHelper.createError(sfe);
logger.error("localProxy is null", sfe);
} else {
logger.debug("begin localProxy.invoke");
String swInvoderKey = "InvokeRealService_" + request.getLookup() + "." + request.getMethodName();
sw.startNew(swInvoderKey, sbInvokerMsg.toString());
sw.setFromIP(context.getChannel().getRemoteIP());
sw.setLocalIP(context.getChannel().getLocalIP());
//invoker real service