/** * Message contains MethodCall. Execute it against *this* object and return result. * Use MethodCall.invoke() to do this. Return result. */ public Object handle(Message req) throws Exception { if(server_obj == null) { log.error(Util.getMessage("NoMethodHandlerIsRegisteredDiscardingRequest")); return null; } if(req == null || req.getLength() == 0) { log.error(Util.getMessage("MessageOrMessageBufferIsNull")); return null; } MethodCall method_call=methodCallFromBuffer(req.getRawBuffer(), req.getOffset(), req.getLength(), marshaller); if(log.isTraceEnabled()) log.trace("[sender=%s], method_call: %s", req.getSrc(), method_call); if(method_call.mode() == MethodCall.ID) { if(method_lookup == null) throw new Exception(String.format("MethodCall uses ID=%d, but method_lookup has not been set", method_call.methodId())); Method m=method_lookup.findMethod(method_call.methodId()); if(m == null) throw new Exception("no method found for " + method_call.methodId()); method_call.method(m); } return method_call.invoke(server_obj); }
/** * Message contains MethodCall. Execute it against *this* object and return result. * Use MethodCall.invoke() to do this. Return result. */ public Object handle(Message req) throws Exception { if(server_obj == null) { log.error(Util.getMessage("NoMethodHandlerIsRegisteredDiscardingRequest")); return null; } if(req == null || req.getLength() == 0) { log.error(Util.getMessage("MessageOrMessageBufferIsNull")); return null; } MethodCall method_call=methodCallFromBuffer(req.getRawBuffer(), req.getOffset(), req.getLength(), marshaller); if(log.isTraceEnabled()) log.trace("[sender=%s], method_call: %s", req.getSrc(), method_call); if(method_call.mode() == MethodCall.ID) { if(method_lookup == null) throw new Exception(String.format("MethodCall uses ID=%d, but method_lookup has not been set", method_call.methodId())); Method m=method_lookup.findMethod(method_call.methodId()); if(m == null) throw new Exception("no method found for " + method_call.methodId()); method_call.method(m); } return method_call.invoke(server_obj); }