You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2009/08/27 17:33:42 UTC

svn commit: r808457 - /tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java

Author: antelder
Date: Thu Aug 27 15:32:18 2009
New Revision: 808457

URL: http://svn.apache.org/viewvc?rev=808457&view=rev
Log:
Initial update to handle nodes being restarted. Similar changes needed in many places but this gets the StopStartNodesTestCase running

Modified:
    tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java

Modified: tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java?rev=808457&r1=808456&r2=808457&view=diff
==============================================================================
--- tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java (original)
+++ tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java Thu Aug 27 15:32:18 2009
@@ -128,20 +128,41 @@
         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;
+            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);
+            }
+
+            // 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;
+        }
     }
 
     /**