tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r1042609 - in /tuscany/sca-java-2.x/trunk: modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/ modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/ module...
Date Mon, 06 Dec 2010 12:47:39 GMT
Author: slaws
Date: Mon Dec  6 12:47:39 2010
New Revision: 1042609

URL: http://svn.apache.org/viewvc?rev=1042609&view=rev
Log:
TUSCANY-3801 - move chain tail location code into the chain implementation

Modified:
    tuscany/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
    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/InvocationChain.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/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.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-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java?rev=1042609&r1=1042608&r2=1042609&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
Mon Dec  6 12:47:39 2010
@@ -209,7 +209,7 @@ public class TestRuntimeWire implements 
     public void invokeAsync(Operation operation, Message msg) {
     }
     
-    public void invokeAsyncResponse(InvokerAsync tailInvoker, Message msg) {
+    public void invokeAsyncResponse(Message msg) {
     }
 
     public void unbind() {

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=1042609&r1=1042608&r2=1042609&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
Mon Dec  6 12:47:39 2010
@@ -39,7 +39,7 @@ public class SCABindingAsyncResponseInvo
     // TODO - this only works for the local case!
     public Message invoke(Message msg) {
         RuntimeEndpointReference epr = (RuntimeEndpointReference)msg.getFrom();
-        epr.invokeAsyncResponse(null, msg);
+        epr.invokeAsyncResponse(msg);
         return null;
     }
 }

Modified: tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java?rev=1042609&r1=1042608&r2=1042609&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java
Mon Dec  6 12:47:39 2010
@@ -82,6 +82,13 @@ public interface InvocationChain {
     Invoker getHeadInvoker();
     
     /**
+     * Returns the last invoker in the chain.
+     *
+     * @return The last invoker in the chain
+     */
+    Invoker getTailInvoker();    
+    
+    /**
      * Get the first invoker that is on the same or later phase 
      * @param phase
      * @return The first invoker that is on the same or later phase

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=1042609&r1=1042608&r2=1042609&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
Mon Dec  6 12:47:39 2010
@@ -145,7 +145,7 @@ public interface Invocable {
      * @param tailInvoker the  invoker at the end of the chain
      * @param msg The request message
      */
-    void invokeAsyncResponse(InvokerAsync tailInvoker, Message msg);    
+    void invokeAsyncResponse(Message msg);    
 
     /**
      * Get a list of policy providers

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=1042609&r1=1042608&r2=1042609&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
Mon Dec  6 12:47:39 2010
@@ -293,8 +293,8 @@ public class RuntimeEndpointImpl extends
         invoker.invokeAsync(msg);
     }
     
-    public void invokeAsyncResponse(InvokerAsync tailInvoker, Message msg){
-        invoker.invokeAsyncResponse(tailInvoker, msg);
+    public void invokeAsyncResponse(Message msg){
+        invoker.invokeAsyncResponse(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=1042609&r1=1042608&r2=1042609&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
Mon Dec  6 12:47:39 2010
@@ -245,8 +245,8 @@ public class RuntimeEndpointReferenceImp
         invoker.invokeAsync(msg);
     }
     
-    public void invokeAsyncResponse(InvokerAsync tailInvoker, Message msg){
-        invoker.invokeAsyncResponse(tailInvoker, msg);
+    public void invokeAsyncResponse(Message msg){
+        invoker.invokeAsyncResponse(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=1042609&r1=1042608&r2=1042609&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
Mon Dec  6 12:47:39 2010
@@ -176,39 +176,10 @@ public class RuntimeInvoker implements I
         return;
     }
     
-    public void invokeAsyncResponse(InvokerAsync tailInvoker, Message msg) {  
+    public void invokeAsyncResponse(Message msg) {  
         
-        // TODO - I pass a tail invoker in as on the service side I have one handy
-        //        but calculate it here if it's not passed in
-        if (tailInvoker == null){
-            Operation operation = msg.getOperation();
-            InvocationChain chain = invocable.getInvocationChain(operation);
-            
-            // find the tail invoker 
-            Invoker next = chain.getHeadInvoker();
-            Invoker tail = null;
-            while (next != null){
-                tail = next;
-                if (next instanceof Interceptor){
-                    next = ((Interceptor)next).getNext();
-                    
-                    // TODO - hack to get round SCA binding optimization
-                    //        On the refrence side this loop will go all the way 
-                    //        across to the service invoker so stop the look if we find 
-                    //        an invoker with no previous pointer. This will be the point
-                    //        where the SCA binding invoker points to the head of the 
-                    //        service chain
-                    
-                    if (!(next instanceof InterceptorAsync) || 
-                         ((InterceptorAsync)next).getPrevious() == null){
-                        break;
-                    }
-                } else {
-                    next = null;
-                }
-            }
-            tailInvoker = (InvokerAsync)tail;
-        }
+        InvocationChain chain = invocable.getInvocationChain(msg.getOperation());
+        InvokerAsync tailInvoker = (InvokerAsync)chain.getTailInvoker();
         
         Message asyncResponseMsg = tailInvoker.invokeAsyncResponse(msg);
         

Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java?rev=1042609&r1=1042608&r2=1042609&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java
Mon Dec  6 12:47:39 2010
@@ -91,6 +91,34 @@ public class InvocationChainImpl impleme
         return nodes.isEmpty() ? null : nodes.get(0).getInvoker();
     }
     
+    public Invoker getTailInvoker() {
+        // find the tail invoker 
+        Invoker next = getHeadInvoker();
+        Invoker tail = null;
+        while (next != null){
+            tail = next;
+            if (next instanceof Interceptor){
+                next = ((Interceptor)next).getNext();
+                
+                // TODO - hack to get round SCA binding optimization
+                //        On the reference side this loop will go all the way 
+                //        across to the service invoker so stop looking if we find 
+                //        an invoker with no "previous" pointer. This will be the point
+                //        where the SCA binding invoker points to the head of the 
+                //        service chain
+                
+                if (!(next instanceof InterceptorAsync) || 
+                     ((InterceptorAsync)next).getPrevious() == null){
+                    break;
+                }
+            } else {
+                next = null;
+            }
+        }
+
+        return tail;
+    }
+    
     public Invoker getHeadInvoker(String phase) {
         int index = phaseManager.getAllPhases().indexOf(phase);
         if (index == -1) {

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=1042609&r1=1042608&r2=1042609&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
Mon Dec  6 12:47:39 2010
@@ -67,7 +67,7 @@ class SampleWSDLInvoker extends Intercep
         // component implementation itself doesn't get a chance to 
         // do async responses. 
         
-        ((RuntimeEndpoint)endpoint).invokeAsyncResponse(this, responseMsg);
+        ((RuntimeEndpoint)endpoint).invokeAsyncResponse(responseMsg);
     }
     
     public Message processRequest(Message msg) {



Mime
View raw message