From f6d17baa1f3c7aa7eb46fcde0d99782a295f87d7 Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 27 Aug 2009 15:32:18 +0000 Subject: Initial update to handle nodes being restarted. Similar changes needed in many places but this gets the StopStartNodesTestCase running git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@808457 13f79535-47bb-0310-9956-ffa450edef68 --- .../core/invocation/impl/JDKInvocationHandler.java | 43 ++++++++++++++++------ 1 file changed, 32 insertions(+), 11 deletions(-) (limited to 'java/sca/modules') diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java index 5f36803b91..d49cd70035 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java @@ -128,20 +128,41 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable { if (wire == null) { throw new ServiceRuntimeException("No runtime wire is available"); } - InvocationChain chain = getInvocationChain(method, wire); - if (chain == null) { - throw new IllegalArgumentException("No matching operation is found: " + method); - } + try { + InvocationChain chain = getInvocationChain(method, wire); + + if (chain == null) { + throw new IllegalArgumentException("No matching operation is found: " + method); + } - // The EndpointReference is not now resolved until the invocation chain - // is first created so reset the source here - source = wire.getEndpointReference(); - - // send the invocation down the wire - Object result = invoke(chain, args, wire, source); + // The EndpointReference is not now resolved until the invocation chain + // is first created so reset the source here + source = wire.getEndpointReference(); + + // send the invocation down the wire + Object result = invoke(chain, args, wire, source); + + return result; + } catch (TargetResolutionException e) { + // the service node has gone so clear and rebuild and try invoke again + wire.rebuild(); + chains.clear(); + InvocationChain chain = getInvocationChain(method, wire); + + if (chain == null) { + throw new IllegalArgumentException("No matching operation is found: " + method); + } - return result; + // The EndpointReference is not now resolved until the invocation chain + // is first created so reset the source here + source = wire.getEndpointReference(); + + // send the invocation down the wire + Object result = invoke(chain, args, wire, source); + + return result; + } } /** -- cgit v1.2.3