use of io.joynr.Sync in project joynr by bmwcarit.
the class ProxyInvocationHandlerImpl method invoke.
@Override
@CheckForNull
public Object invoke(@Nonnull Method method, Object[] args) throws ApplicationException {
logger.trace("calling proxy.{}({}) on domain: {} and interface {}, proxy participant ID: {}", method.getName(), args, domains, interfaceName, proxyParticipantId);
Class<?> methodInterfaceClass = method.getDeclaringClass();
try {
if (JoynrSubscriptionInterface.class.isAssignableFrom(methodInterfaceClass) || JoynrBroadcastSubscriptionInterface.class.isAssignableFrom(methodInterfaceClass)) {
return executeSubscriptionMethod(method, args);
} else if (methodInterfaceClass.getAnnotation(FireAndForget.class) != null) {
return executeOneWayMethod(method, args);
} else if (methodInterfaceClass.getAnnotation(Sync.class) != null) {
return executeSyncMethod(method, args);
} else if (methodInterfaceClass.getAnnotation(Async.class) != null) {
return executeAsyncMethod(method, args);
} else {
throw new JoynrIllegalStateException("Method is not part of sync, async or subscription interface");
}
} catch (JoynrRuntimeException | ApplicationException e) {
throw e;
} catch (Exception e) {
throw new JoynrRuntimeException(e);
}
}
Aggregations