From f1f12d88cb6637d4273a53012170d855581a7f64 Mon Sep 17 00:00:00 2001 From: slaws Date: Thu, 14 Jul 2011 13:39:00 +0000 Subject: Be more precise about when the async response path should be connected up in the service binding wire. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1146705 13f79535-47bb-0310-9956-ffa450edef68 --- .../core/assembly/impl/RuntimeEndpointImpl.java | 27 +++++++--------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'sca-java-2.x/trunk/modules/core/src/main/java') diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java index 6790f3b870..9248d35db3 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java @@ -664,34 +664,23 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint // This is strategically placed before the RuntimeInvoker is added to the end of the // binding chain as the RuntimeInvoker doesn't need to take part in the response // processing and doesn't implement InvokerAsyncResponse - if (isAsyncInvocation()){ + ServiceBindingProvider serviceBindingProvider = getBindingProvider(); + if (isAsyncInvocation() && + serviceBindingProvider instanceof EndpointAsyncProvider && + ((EndpointAsyncProvider)serviceBindingProvider).supportsNativeAsync()){ // fix up the invocation chains to point back to the // binding chain so that async response messages // are processed correctly for (InvocationChain chain : getInvocationChains()){ Invoker invoker = chain.getHeadInvoker(); - if (invoker instanceof InterceptorAsync){ - ((InterceptorAsync)invoker).setPrevious((InvokerAsyncResponse)bindingInvocationChain.getTailInvoker()); - } else { - // TODO - raise an error. Not doing that while - // we have the old async mechanism in play - } + ((InterceptorAsync)invoker).setPrevious((InvokerAsyncResponse)bindingInvocationChain.getTailInvoker()); } // end for // fix up the binding chain response path to point back to the // binding provided async response handler - ServiceBindingProvider serviceBindingProvider = getBindingProvider(); - if (serviceBindingProvider instanceof EndpointAsyncProvider){ - EndpointAsyncProvider asyncEndpointProvider = (EndpointAsyncProvider)serviceBindingProvider; - InvokerAsyncResponse asyncResponseInvoker = asyncEndpointProvider.createAsyncResponseInvoker(); - if (bindingInvocationChain.getHeadInvoker() instanceof InterceptorAsync){ - ((InterceptorAsync)bindingInvocationChain.getHeadInvoker()).setPrevious(asyncResponseInvoker); - } else { - //TODO - throw error once the old async code is removed - } - } else { - //TODO - throw error once the old async code is removed - } // end if + EndpointAsyncProvider asyncEndpointProvider = (EndpointAsyncProvider)serviceBindingProvider; + InvokerAsyncResponse asyncResponseInvoker = asyncEndpointProvider.createAsyncResponseInvoker(); + ((InterceptorAsync)bindingInvocationChain.getHeadInvoker()).setPrevious(asyncResponseInvoker); } // end if // Add the runtime invoker to the end of the binding chain. -- cgit v1.2.3