summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-rw-r--r--sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java2
-rw-r--r--sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java2
-rw-r--r--sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java7
-rw-r--r--sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java2
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java4
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java4
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java35
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java28
8 files changed, 45 insertions, 39 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java b/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
index 756299696a..db0e571ef6 100644
--- a/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
+++ b/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
@@ -209,7 +209,7 @@ public class TestRuntimeWire implements RuntimeEndpoint {
public void invokeAsync(Operation operation, Message msg) {
}
- public void invokeAsyncResponse(InvokerAsync tailInvoker, Message msg) {
+ public void invokeAsyncResponse(Message msg) {
}
public void unbind() {
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 8072b70795..26707e8ebd 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
@@ -39,7 +39,7 @@ public class SCABindingAsyncResponseInvoker implements Invoker {
// 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;
}
}
diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java
index d10a5689d4..1d38ec7101 100644
--- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java
+++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java
@@ -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
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 cf9b8ac49e..7c7c104947 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
@@ -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
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 32aa0c0646..d74ee4a8f9 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
@@ -293,8 +293,8 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint
invoker.invokeAsync(msg);
}
- public void invokeAsyncResponse(InvokerAsync tailInvoker, Message msg){
- invoker.invokeAsyncResponse(tailInvoker, msg);
+ public void invokeAsyncResponse(Message msg){
+ invoker.invokeAsyncResponse(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 2aadf34295..b8ca59b214 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
@@ -245,8 +245,8 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen
invoker.invokeAsync(msg);
}
- public void invokeAsyncResponse(InvokerAsync tailInvoker, Message msg){
- invoker.invokeAsyncResponse(tailInvoker, msg);
+ public void invokeAsyncResponse(Message msg){
+ invoker.invokeAsyncResponse(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 7700eeb79c..e1ec899fa5 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
@@ -176,39 +176,10 @@ public class RuntimeInvoker implements Invoker{
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);
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java
index 477f84e690..716379d141 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java
@@ -91,6 +91,34 @@ public class InvocationChainImpl implements InvocationChain {
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) {