summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/core
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-08-28 10:15:19 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-08-28 10:15:19 +0000
commit93240046708547db398dbe4f93583f92b19ef7f1 (patch)
tree66db51b36ade187b045b562f4cee69533cd60575 /java/sca/modules/core
parent1e6dfca020c2d5bac36990da4df1b0a2a4194f6b (diff)
Update to add a method to check if a wire target is out of date compared to teh endpoint registry (see ML discussion 'Endpoint registry and stopping/starting nodes'
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@808838 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/core')
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl.java4
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java61
2 files changed, 20 insertions, 45 deletions
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl.java
index b31a8e7d1a..78811ebf7e 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl.java
@@ -771,5 +771,9 @@ public class RuntimeWireImpl implements RuntimeWire {
// No promoted service
return null;
}
+ }
+
+ public boolean isOutOfDate() {
+ return endpointReferenceBuilder.isOutOfDate(getEndpointReference());
}
}
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 6bd7ebd301..42625e9ea1 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
@@ -130,54 +130,25 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
throw new ServiceRuntimeException("No runtime wire is available");
}
- 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);
-
- return result;
- } catch (TargetResolutionException e) {
- // the service node has gone so clear and rebuild and try invoke again
+ if (wire.isOutOfDate()) {
wire.rebuild();
chains.clear();
- 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);
-
- 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;
- }
}
+
+ 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;
}
/**