You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2010/12/08 16:18:16 UTC
svn commit: r1043447 - in /tuscany/sca-java-2.x/trunk:
modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/
modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/
modules/core-spi/src/main/java/org/apache/tu...
Author: slaws
Date: Wed Dec 8 15:18:12 2010
New Revision: 1043447
URL: http://svn.apache.org/viewvc?rev=1043447&view=rev
Log:
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
Modified:
tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java
tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java
tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java
tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java
tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java
tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java
tuscany/sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java
tuscany/sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java
Modified: tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java?rev=1043447&r1=1043446&r2=1043447&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java Wed Dec 8 15:18:12 2010
@@ -38,9 +38,4 @@ public class SCABindingAsyncResponseInvo
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
Modified: tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java?rev=1043447&r1=1043446&r2=1043447&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java Wed Dec 8 15:18:12 2010
@@ -37,4 +37,26 @@ public interface InterceptorAsync extend
*/
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);
+
}
Modified: tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java?rev=1043447&r1=1043446&r2=1043447&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java Wed Dec 8 15:18:12 2010
@@ -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);
-
-
}
Modified: tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java?rev=1043447&r1=1043446&r2=1043447&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java Wed Dec 8 15:18:12 2010
@@ -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);
-
}
Modified: tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java?rev=1043447&r1=1043446&r2=1043447&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java Wed Dec 8 15:18:12 2010
@@ -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
Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java?rev=1043447&r1=1043446&r2=1043447&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java Wed Dec 8 15:18:12 2010
@@ -290,7 +290,7 @@ public class RuntimeEndpointImpl extends
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);
}
Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java?rev=1043447&r1=1043446&r2=1043447&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java Wed Dec 8 15:18:12 2010
@@ -243,7 +243,7 @@ public class RuntimeEndpointReferenceImp
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);
}
Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java?rev=1043447&r1=1043446&r2=1043447&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java Wed Dec 8 15:18:12 2010
@@ -112,6 +112,12 @@ public class RuntimeInvoker implements I
}
}
+ /**
+ * 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 I
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 I
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);
}
}
Modified: tuscany/sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java?rev=1043447&r1=1043446&r2=1043447&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java (original)
+++ tuscany/sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java Wed Dec 8 15:18:12 2010
@@ -63,9 +63,4 @@ class SampleAsyncResponseInvoker impleme
// TODO - need to throw this to somewhere?
}
}
-
- public Message processResponse(Message msg) {
- // Do nothing as no need to share the processing with synch here.
- return null;
- }
}
Modified: tuscany/sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java?rev=1043447&r1=1043446&r2=1043447&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java (original)
+++ tuscany/sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java Wed Dec 8 15:18:12 2010
@@ -65,7 +65,10 @@ class SampleWSDLInvoker extends Intercep
// component implementation itself doesn't get a chance to
// do async responses.
- ((RuntimeEndpoint)endpoint).invokeAsyncResponse(responseMsg);
+ // At this point we could serialize the ??? and pick it up again
+ // later to send the async response
+
+ ((RuntimeEndpoint)msg.getTo()).invokeAsyncResponse(responseMsg);
}
public Message processRequest(Message msg) {