Search in sources :

Example 1 with MethodInvocation

use of io.joynr.proxy.invocation.MethodInvocation in project joynr by bmwcarit.

the class ProxyInvocationHandlerImpl method abort.

@Override
public void abort(JoynrRuntimeException exception) {
    setThrowableForInvoke(exception);
    for (Iterator<MethodInvocation<?>> iterator = queuedRpcList.iterator(); iterator.hasNext(); ) {
        MethodInvocation<?> invocation = iterator.next();
        try {
            MethodMetaInformation metaInfo = new MethodMetaInformation(invocation.getMethod());
            int callbackIndex = metaInfo.getCallbackIndex();
            if (callbackIndex > -1) {
                ICallback callback = (ICallback) invocation.getArgs()[callbackIndex];
                callback.onFailure(exception);
            }
        } catch (Exception metaInfoException) {
            logger.error("aborting call to method: " + invocation.getMethod().getName() + " but unable to call onError callback because of: " + metaInfoException.getMessage(), metaInfoException);
        }
        invocation.getFuture().onFailure(exception);
    }
    for (Iterator<UnsubscribeInvocation> iterator = queuedUnsubscripeInvocationList.iterator(); iterator.hasNext(); ) {
        Invocation<String> invocation = iterator.next();
        invocation.getFuture().onFailure(exception);
    }
    for (SubscriptionAction subscriptionAction : queuedSubscriptionInvocationList) {
        subscriptionAction.fail(exception);
    }
}
Also used : UnsubscribeInvocation(io.joynr.proxy.invocation.UnsubscribeInvocation) MethodMetaInformation(joynr.MethodMetaInformation) MethodInvocation(io.joynr.proxy.invocation.MethodInvocation) DiscoveryException(io.joynr.exceptions.DiscoveryException) JoynrException(io.joynr.exceptions.JoynrException) ApplicationException(joynr.exceptions.ApplicationException) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException) JoynrIllegalStateException(io.joynr.exceptions.JoynrIllegalStateException)

Aggregations

DiscoveryException (io.joynr.exceptions.DiscoveryException)1 JoynrException (io.joynr.exceptions.JoynrException)1 JoynrIllegalStateException (io.joynr.exceptions.JoynrIllegalStateException)1 JoynrRuntimeException (io.joynr.exceptions.JoynrRuntimeException)1 MethodInvocation (io.joynr.proxy.invocation.MethodInvocation)1 UnsubscribeInvocation (io.joynr.proxy.invocation.UnsubscribeInvocation)1 MethodMetaInformation (joynr.MethodMetaInformation)1 ApplicationException (joynr.exceptions.ApplicationException)1