diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-12-09 11:56:11 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-12-09 11:56:11 +0000 |
commit | 21c4fe09a85c35932b3240f3a4141849e80496da (patch) | |
tree | 1a3a6d9cb787b42995551fcde9715d7cb1a3cf47 /sca-java-2.x/trunk/modules/core/src | |
parent | 8d8b0bab043fad2f4773c40cff8c2a1e6d935df6 (diff) |
TUSCANY-3801 - Make the async invoker creation signature more consistent with the invoke creation signature
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1043910 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/core/src')
2 files changed, 17 insertions, 5 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 e353af92e2..f4408429df 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 @@ -713,7 +713,7 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint } } else if (isAsyncInvocation() && provider instanceof ImplementationAsyncProvider){ - invoker = (Invoker)((ImplementationAsyncProvider)provider).createAsyncInvoker(this, (RuntimeComponentService)service, operation); + invoker = (Invoker)((ImplementationAsyncProvider)provider).createAsyncInvoker((RuntimeComponentService)service, operation); } else { invoker = provider.createInvoker((RuntimeComponentService)service, operation); } diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java index 4b2e72ac6b..f894290b3e 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java @@ -39,6 +39,7 @@ import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.runtime.Invocable; import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; import org.apache.tuscany.sca.work.WorkScheduler; +import org.oasisopen.sca.ServiceRuntimeException; /** * Invoker for a endpoint or endpoint reference @@ -120,14 +121,23 @@ public class RuntimeInvoker implements Invoker{ */ public void invokeAsync(Message msg) { if (invocable instanceof Endpoint) { - msg.setTo((Endpoint)invocable); + Endpoint ep = (Endpoint)invocable; + msg.setTo(ep); + if (!ep.isAsyncInvocation()){ + throw new ServiceRuntimeException("Calling invokeAsync on a non-async endpoint - " + + ep); + } } else if (invocable instanceof EndpointReference) { RuntimeEndpointReference epr = (RuntimeEndpointReference)invocable; + if (!epr.isAsyncInvocation()){ + throw new ServiceRuntimeException("Calling invokeAsync on a non-async endpoint reference - " + + epr); + } if (epr.isOutOfDate()) { epr.rebuild(); } - msg.setFrom((EndpointReference)invocable); - msg.setTo(((EndpointReference)invocable).getTargetEndpoint()); + msg.setFrom(epr); + msg.setTo(epr.getTargetEndpoint()); } Operation operation = msg.getOperation(); @@ -153,8 +163,10 @@ public class RuntimeInvoker implements Invoker{ // temporary fix to swallow the dummy exception that's // thrown back to get past the response chain processing. if (!(ex instanceof AsyncResponseException)){ - // TODO send the exception in through the + // send the exception in through the // async response processing path + msg.setFaultBody(ex); + invokeAsyncResponse(msg); } } } finally { |