diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-12-07 11:23:53 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-12-07 11:23:53 +0000 |
commit | 74c8e2f04c98bd599c29709203737009b75f224a (patch) | |
tree | 7791b5c061679f94f88aeed0da51a776d53fbb7a /sca-java-2.x/trunk/modules/core-spi/src/main/java/org | |
parent | c8fc4b58a3c30107f403e53f1213af0946121e5a (diff) |
TUSCANY-3801 - Allow the response chain "previous" link to be attached to an async response handler so that the invokerAsyncResponse can have a void return type.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1042976 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
6 files changed, 62 insertions, 82 deletions
diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsync.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsync.java deleted file mode 100644 index a67a28a931..0000000000 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsync.java +++ /dev/null @@ -1,74 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.invocation;
-
-/**
- * TUSCANY-3786
- *
- * Interface to describe an invoation where the request processing
- * can be performed independently of the response processing. This
- * has been instigated to allow async responses to be processed
- * independently of the requests that instigated them. Due to the need
- * to run the reponse processing interceptors effectively backwards the
- * methods defined here are not responsible for finding the next invoker
- * in the chain.
- *
- */
-public interface InvokerAsync {
-
- /**
- * Process the forward message and pass it down the chain
- *
- * @param msg The request Message
- * @return the processed message
- *
- */
- void invokeAsyncRequest(Message msg);
-
- /**
- * Process response message and pass it back up the chain.
- * This returns the message that is processed by the chain
- * so that it can be passes onto the appropriate invoker by the caller
- * the response path doesn't have an invoker.
- *
- * @param msg The request Message
- * @return the processed message
- *
- */
- Message invokeAsyncResponse(Message msg);
-
- /**
- * Process a request message
- *
- * @param msg The request Message
- * @return the processed message
- *
- */
- Message processRequest(Message msg);
-
- /**
- * Process a response message
- *
- * @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 new file mode 100644 index 0000000000..5a53504ffb --- /dev/null +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java @@ -0,0 +1,51 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.invocation;
+
+/**
+ * TUSCANY-3786
+ *
+ * The request side of an Interface to describe an invocation where
+ * the request processing can be performed independently of the
+ * response processing.
+ */
+public interface InvokerAsyncRequest {
+
+ /**
+ * Process the request message and pass it down the chain
+ *
+ * @param msg The request Message
+ * @return the processed message
+ *
+ */
+ 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/provider/EndpointAsyncProvider.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointAsyncProvider.java index dbf0c0fd8d..b74b1dd9a7 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointAsyncProvider.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointAsyncProvider.java @@ -21,6 +21,7 @@ package org.apache.tuscany.sca.provider; import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.InvokerAsyncResponse;
/**
@@ -51,5 +52,5 @@ public interface EndpointAsyncProvider extends EndpointProvider { * @para operation
* @return the invoker that will dispatch the async response
*/
- Invoker createAsyncResponseInvoker(Operation operation);
+ InvokerAsyncResponse createAsyncResponseInvoker();
}
diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointReferenceAsyncProvider.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointReferenceAsyncProvider.java index 536b6f2ea5..044ba523b9 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointReferenceAsyncProvider.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointReferenceAsyncProvider.java @@ -31,11 +31,10 @@ public interface EndpointReferenceAsyncProvider extends EndpointReferenceProvide /**
* TUSCANY-3801
- * Returns true if the service binding provider is natively able
- * to dispatch async responses.
+ * Returns true if the reference binding provider is natively able
+ * to receive async responses.
*
* @return true if the service provide support async operation natively
*/
boolean supportsNativeAsync();
-
}
diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationAsyncProvider.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationAsyncProvider.java index b555087d82..1ddf015568 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationAsyncProvider.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationAsyncProvider.java @@ -22,6 +22,8 @@ package org.apache.tuscany.sca.provider; import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.InvokerAsyncRequest;
+import org.apache.tuscany.sca.invocation.InvokerAsyncResponse;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
/**
@@ -36,9 +38,10 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentService; public interface ImplementationAsyncProvider extends ImplementationProvider {
/**
+ * TUSCANY-3801
* Create an async invoker for the component implementation in the invocation
* chain. The invoker will be responsible for calling the implementation
- * logic for the given component. The only realy difference between this and
+ * logic for the given component. The only real difference between this and
* createInvoker is that the Endpoint is passed in so that the invoker can
* engineer the async response
*
@@ -48,9 +51,10 @@ public interface ImplementationAsyncProvider extends ImplementationProvider { * @return An invoker that handles the invocation logic, null should be
* returned if no invoker is required
*/
- Invoker createAsyncInvoker(Endpoint endpoint, RuntimeComponentService service, Operation operation);
+ InvokerAsyncRequest createAsyncInvoker(Endpoint endpoint, RuntimeComponentService service, Operation operation);
/**
+ * TUSCANY-3801
* Create an invoker for the asynchronous responses in the invocation
* chain. The invoker will be responsible for processing the async
* response including correlating it with the forward call using
@@ -60,6 +64,6 @@ public interface ImplementationAsyncProvider extends ImplementationProvider { * @param operation The operation that the interceptor will handle
* @return An AsyncResponseHandler<T> instance
*/
- Invoker createAsyncResponseInvoker(Operation operation);
+ InvokerAsyncResponse createAsyncResponseInvoker(Operation operation);
}
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 7c7c104947..9a936bf141 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 @@ -29,7 +29,6 @@ import org.apache.tuscany.sca.context.CompositeContext; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.InvocationChain; -import org.apache.tuscany.sca.invocation.InvokerAsync; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.provider.PolicyProvider; |