summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java27
1 files changed, 8 insertions, 19 deletions
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.