summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-08-27 15:32:18 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-08-27 15:32:18 +0000
commitf6d17baa1f3c7aa7eb46fcde0d99782a295f87d7 (patch)
treeb5cfab2aeb4570d9489d7688516ebfb05154e9ab /java
parent19c0a532d94d0e01fa30e207831062c16b8e6b28 (diff)
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
Diffstat (limited to 'java')
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java43
1 files changed, 32 insertions, 11 deletions
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;
+ }
}
/**