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 2011/01/14 15:55:35 UTC

svn commit: r1059030 - /tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java

Author: slaws
Date: Fri Jan 14 14:55:35 2011
New Revision: 1059030

URL: http://svn.apache.org/viewvc?rev=1059030&view=rev
Log:
TUSCANY-3801 - make the non-blocking interceptor work with native async bindings

Modified:
    tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java

Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java?rev=1059030&r1=1059029&r2=1059030&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java Fri Jan 14 14:55:35 2011
@@ -38,7 +38,7 @@ import org.oasisopen.sca.ServiceRuntimeE
  *
  * @version $Rev$ $Date$
  */
-public class NonBlockingInterceptor implements Interceptor {
+public class NonBlockingInterceptor extends InterceptorAsyncImpl {
 
     private static final Message RESPONSE = new ImmutableMessage();
 
@@ -48,7 +48,6 @@ public class NonBlockingInterceptor impl
     private static final Logger LOGGER = Logger.getLogger(NonBlockingInterceptor.class.getName());
 
     private WorkScheduler workScheduler;
-    private Invoker next;
 
     public NonBlockingInterceptor(WorkScheduler workScheduler) {
         this.workScheduler = workScheduler;
@@ -69,6 +68,11 @@ public class NonBlockingInterceptor impl
         this.workScheduler = workScheduler;
     }
 
+    /**
+     * For request/response messages use the workScheduler to break the connection between
+     * requests and the void response
+     */
+    @Override
     public Message invoke(final Message msg) {
         // Schedule the invocation of the next interceptor in a new Work instance
         try {
@@ -107,13 +111,21 @@ public class NonBlockingInterceptor impl
         }
         return RESPONSE;
     }
-
-    public Invoker getNext() {
-        return next;
+    
+    /**
+     * For forward async responses we just pass the message along
+     * as this is naturally one way
+     */
+    public Message processRequest(Message msg) {
+        return msg;
     }
-
-    public void setNext(Invoker next) {
-        this.next = next;
+    
+    /**
+     * This should never be called as a one way message won't
+     * expect a response
+     */
+    public Message processResponse(Message msg) {
+        return null;
     }
 
     /**