use of io.joynr.proxy.MethodSignature in project joynr by bmwcarit.
the class RequestInterpreter method invokeMethod.
public Object invokeMethod(RequestCaller requestCaller, OneWayRequest request) {
// A method is identified by its defining request caller, its name and the types of its arguments
MethodSignature methodSignature = new MethodSignature(requestCaller, request.getMethodName(), request.getParamDatatypes());
ensureMethodMetaInformationPresent(requestCaller, request, methodSignature);
Method method = methodSignatureToMethodMap.get(methodSignature);
Object[] params = null;
try {
if (method.getParameterTypes().length > 0) {
// method with parameters
params = request.getParams();
}
joynrMessageScope.activate();
setContext(requestCaller, request);
logger.trace("invoke provider method {}({})", method.getName(), params == null ? "" : params);
return requestCaller.invoke(method, params);
} catch (IllegalAccessException e) {
logger.error("RequestInterpreter: Received an RPC invocation for a non public method {}", request);
JoynrVersion joynrVersion = AnnotationUtil.getAnnotation(requestCaller.getProxy().getClass(), JoynrVersion.class);
throw new MethodInvocationException(e, new Version(joynrVersion.major(), joynrVersion.minor()));
} catch (InvocationTargetException e) {
logger.debug("invokeMethod error", e);
Throwable cause = e.getCause();
logger.error("RequestInterpreter: Could not perform an RPC invocation: {}", cause == null ? e.toString() : cause.getMessage());
throw new ProviderRuntimeException(cause == null ? e.toString() : cause.toString());
} finally {
requestCaller.removeContext();
joynrMessageScope.deactivate();
}
}
Aggregations