Search in sources :

Example 1 with Sync

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);
    }
}
Also used : JoynrSubscriptionInterface(io.joynr.dispatcher.rpc.JoynrSubscriptionInterface) ApplicationException(joynr.exceptions.ApplicationException) Sync(io.joynr.Sync) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException) JoynrBroadcastSubscriptionInterface(io.joynr.dispatcher.rpc.JoynrBroadcastSubscriptionInterface) JoynrIllegalStateException(io.joynr.exceptions.JoynrIllegalStateException) DiscoveryException(io.joynr.exceptions.DiscoveryException) JoynrException(io.joynr.exceptions.JoynrException) ApplicationException(joynr.exceptions.ApplicationException) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException) JoynrIllegalStateException(io.joynr.exceptions.JoynrIllegalStateException) CheckForNull(javax.annotation.CheckForNull)

Aggregations

Sync (io.joynr.Sync)1 JoynrBroadcastSubscriptionInterface (io.joynr.dispatcher.rpc.JoynrBroadcastSubscriptionInterface)1 JoynrSubscriptionInterface (io.joynr.dispatcher.rpc.JoynrSubscriptionInterface)1 DiscoveryException (io.joynr.exceptions.DiscoveryException)1 JoynrException (io.joynr.exceptions.JoynrException)1 JoynrIllegalStateException (io.joynr.exceptions.JoynrIllegalStateException)1 JoynrRuntimeException (io.joynr.exceptions.JoynrRuntimeException)1 CheckForNull (javax.annotation.CheckForNull)1 ApplicationException (joynr.exceptions.ApplicationException)1