From 1c3d230b1a82d805893f93ac7e9f82dcd414382f Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 27 Aug 2009 20:41:53 +0000 Subject: More fixes to get invocations working when a node is restarted git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@808613 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/core/invocation/impl/JDKInvocationHandler.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (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 d49cd70035..6bd7ebd301 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 @@ -41,6 +41,7 @@ import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.runtime.RuntimeWire; +import org.oasisopen.sca.SCARuntimeException; import org.oasisopen.sca.ServiceReference; import org.oasisopen.sca.ServiceRuntimeException; @@ -148,6 +149,7 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable { // the service node has gone so clear and rebuild and try invoke again wire.rebuild(); chains.clear(); + try { InvocationChain chain = getInvocationChain(method, wire); if (chain == null) { @@ -157,11 +159,24 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable { // 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 (SCARuntimeException e1) { + // this can be thrown by getInvocationChain if the endpoint isn't available + // clean up so a later request can work + wire.rebuild(); + chains.clear(); + throw e1; + } catch (TargetResolutionException e2) { + //this can be thrown by the invoke if the endpoint has disapeared + // clean up so a later request can work + wire.rebuild(); + chains.clear(); + throw e2; + } } } -- cgit v1.2.3