summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/domain-hazelcast
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-01-14 07:40:46 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-01-14 07:40:46 +0000
commita225821e4c6430d83d4118ce782dca12b79133d7 (patch)
tree487a9c74396ced1275315bf90d433fd4f8202f97 /sca-java-2.x/trunk/modules/domain-hazelcast
parent15b4f6b9d66d71f584a0a98b23454b36727ccdaf (diff)
Update to use local version of Endpoint if a local Endpoint exists
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1058877 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/domain-hazelcast')
-rw-r--r--sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java35
1 files changed, 22 insertions, 13 deletions
diff --git a/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java b/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java
index 6d696dfaaa..004aa81816 100644
--- a/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java
+++ b/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java
@@ -224,23 +224,28 @@ public class HazelcastEndpointRegistry extends BaseEndpointRegistry implements E
Endpoint endpoint = (Endpoint)v;
logger.fine("Matching against - " + endpoint);
if (endpoint.matches(uri)) {
- if (!isLocal(endpoint)) {
- endpoint.setRemote(true);
- ((RuntimeEndpoint)endpoint).bind(registry, this);
- } else {
- // get the local version of the endpoint
- // this local version won't have been serialized
- // won't be marked as remote and will have the
- // full interface contract information
- endpoint = localEndpoints.get(endpoint.getURI());
- }
-
+ endpoint = localizeEndpoint(endpoint);
foundEndpoints.add(endpoint);
logger.fine("Found endpoint with matching service - " + endpoint);
}
}
return foundEndpoints;
}
+
+ private Endpoint localizeEndpoint(Endpoint endpoint) {
+ if (endpoint == null) return null;
+ if (!isLocal(endpoint)) {
+ endpoint.setRemote(true);
+ ((RuntimeEndpoint)endpoint).bind(registry, this);
+ } else {
+ // get the local version of the endpoint
+ // this local version won't have been serialized
+ // won't be marked as remote and will have the
+ // full interface contract information
+ endpoint = localEndpoints.get(endpoint.getURI());
+ }
+ return endpoint;
+ }
private boolean isLocal(Endpoint endpoint) {
@@ -248,11 +253,15 @@ public class HazelcastEndpointRegistry extends BaseEndpointRegistry implements E
}
public Endpoint getEndpoint(String uri) {
- return (Endpoint)endpointMap.get(uri);
+ return localizeEndpoint((Endpoint)endpointMap.get(uri));
}
public List<Endpoint> getEndpoints() {
- return new ArrayList(endpointMap.values());
+ ArrayList<Endpoint> eps = new ArrayList();
+ for (Object ep : endpointMap.values()) {
+ eps.add(localizeEndpoint((Endpoint)ep));
+ }
+ return eps;
}
public void removeEndpoint(Endpoint endpoint) {