summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-12-06 12:47:39 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-12-06 12:47:39 +0000
commitabb2675bc0937b62e91448cfed0c7343ca00b850 (patch)
treea75e960903ae5e031f1d4b3eb6560af440efd36e /sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany
parent7155b9be422a423b9c0cf6555fff710fe2ed6399 (diff)
TUSCANY-3801 - move chain tail location code into the chain implementation
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1042609 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany')
-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
4 files changed, 35 insertions, 36 deletions
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) {