diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-12-08 15:18:12 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-12-08 15:18:12 +0000 |
commit | d56a64505d24516a9ec86d9eba72ad2adac00651 (patch) | |
tree | aabd32ef159ca19b5f8a75b584910d157637e3ee /sca-java-2.x/trunk/modules | |
parent | adc1266eb6cc8f4db2575438b42597a84114fc21 (diff) |
TUSCANY-3801 - Separate off the asyncy response invocation interfaces from the "process" methods I added as a convenience for sharing invoker implementation. Asl get rid of "throws" from Invocable
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1043447 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules')
8 files changed, 40 insertions, 77 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java index d502cdd22c..240ba69d62 100644 --- a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java +++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java @@ -38,9 +38,4 @@ public class SCABindingAsyncResponseInvoker implements InvokerAsyncResponse { RuntimeEndpointReference epr = (RuntimeEndpointReference)msg.getFrom();
epr.invokeAsyncResponse(msg);
}
-
- public Message processResponse(Message msg) {
- // TODO Auto-generated method stub
- return null;
- }
}
\ No newline at end of file diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java index 50bcf13b04..806feccca2 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java @@ -37,4 +37,26 @@ public interface InterceptorAsync extends Interceptor, InvokerAsyncRequest, Invo */
InvokerAsyncResponse getPrevious();
+ /**
+ * Process a request message. Provided so that the synchronous
+ * and asynchronous patterns can re-use the request message
+ * processing
+ *
+ * @param msg The request Message
+ * @return the processed message
+ *
+ */
+ Message processRequest(Message msg);
+
+ /**
+ * Process a response message. Provided so that the synchronous
+ * and asynchronous patterns can re-use the response message
+ * processing
+ *
+ * @param msg The request Message
+ * @return the processed message
+ *
+ */
+ Message processResponse(Message msg);
+
}
diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java index 5a53504ffb..48fad02b53 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java @@ -36,16 +36,4 @@ public interface InvokerAsyncRequest { */
void invokeAsyncRequest(Message msg);
- /**
- * Process a request message. Provided so that the synchronous
- * and asynchronous patterns can re-use the request message
- * processing
- *
- * @param msg The request Message
- * @return the processed message
- *
- */
- Message processRequest(Message msg);
-
-
}
diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java index 1de12638b6..7eeabb760e 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java @@ -36,15 +36,4 @@ public interface InvokerAsyncResponse { */
void invokeAsyncResponse(Message msg);
- /**
- * Process a response message. Provided so that the synchronous
- * and asynchronous patterns can re-use the response message
- * processing
- *
- * @param msg The request Message
- * @return the processed message
- *
- */
- Message processResponse(Message msg);
-
}
diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java index 9a936bf141..948063f480 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java @@ -136,8 +136,7 @@ public interface Invocable { * @return The ticket that can be used to identify this invocation * @throws InvocationTargetException */ - void invokeAsync(Operation operation, Message msg) throws Throwable; - // TODO - this shouldn't throw an exception + void invokeAsync(Operation operation, Message msg); /** * Asynchronously invoke an operation with a context message 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 26fc6722aa..e353af92e2 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 @@ -290,7 +290,7 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint return invoker.invoke(operation, msg); } - public void invokeAsync(Operation operation, Message msg) throws Throwable { + public void invokeAsync(Operation operation, Message msg){ msg.setOperation(operation); invoker.invokeAsync(msg); } diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java index a854e833ac..ad5c9124fa 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java @@ -243,7 +243,7 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen return invoker.invoke(operation, msg); } - public void invokeAsync(Operation operation, Message msg) throws Throwable { + public void invokeAsync(Operation operation, Message msg){ msg.setOperation(operation); invoker.invokeAsync(msg); } 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 6c9f13ff17..4b2e72ac6b 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 @@ -112,6 +112,12 @@ public class RuntimeInvoker implements Invoker{ } } + /** + * Initiate the sending of the forward part of an asynchronous + * exchange along the request part of the wire. + * + * @param msg the request message + */ public void invokeAsync(Message msg) { if (invocable instanceof Endpoint) { msg.setTo((Endpoint)invocable); @@ -141,25 +147,14 @@ public class RuntimeInvoker implements Invoker{ Message msgContext = ThreadMessageContext.setMessageContext(msg); try { - // TODO - is this the way we'll pass async messages down the chain? - Message resp = null; try { ((InvokerAsyncRequest)headInvoker).invokeAsyncRequest(msg); } catch (Throwable ex) { // temporary fix to swallow the dummy exception that's // thrown back to get past the response chain processing. if (!(ex instanceof AsyncResponseException)){ - // throw ex; - } - } - - // This is async but we check the response in case there is a - // fault reported on the forward request, i.e. before the - // request reaches the binding - if (resp != null){ - Object body = resp.getBody(); - if (resp.isFault()) { - //throw (Throwable)body; + // TODO send the exception in through the + // async response processing path } } } finally { @@ -169,42 +164,17 @@ public class RuntimeInvoker implements Invoker{ return; } + /** + * Initiate the sending of the response part of an asynchronous + * exchange along the response part of the wire. + * + * @param msg the response message + */ public void invokeAsyncResponse(Message msg) { InvocationChain chain = invocable.getInvocationChain(msg.getOperation()); Invoker tailInvoker = chain.getTailInvoker(); - ((InvokerAsyncResponse)tailInvoker).invokeAsyncResponse(msg); - -/* now statically configured - // now get the asyncResponseInvoker - Invoker asyncResponseInvoker = null; - - // We'd want to cache this based on the reference EPR - if (invocable instanceof Endpoint) { - // get it from the binding - RuntimeEndpoint ep = (RuntimeEndpoint)invocable; - ServiceBindingProvider serviceBindingProvider = ep.getBindingProvider(); - if (serviceBindingProvider instanceof EndpointAsyncProvider){ - EndpointAsyncProvider asyncEndpointProvider = (EndpointAsyncProvider)serviceBindingProvider; - asyncResponseInvoker = asyncEndpointProvider.createAsyncResponseInvoker(); - - } else { - // TODO - throw error - } - } else if (invocable instanceof EndpointReference) { - // get it from the implementation - RuntimeEndpointReference epr = (RuntimeEndpointReference)invocable; - ImplementationProvider implementationProvider = ((RuntimeComponent)epr.getComponent()).getImplementationProvider(); - - if (implementationProvider instanceof ImplementationAsyncProvider){ - asyncResponseInvoker = ((ImplementationAsyncProvider)implementationProvider).createAsyncResponseInvoker(asyncResponseMsg.getOperation()); - } else { - // TODO - throw an error - } - } - - asyncResponseInvoker.invoke(asyncResponseMsg); -*/ + ((InvokerAsyncResponse)tailInvoker).invokeAsyncResponse(msg); } } |