diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules/core/src/main')
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) { |