diff options
2 files changed, 16 insertions, 6 deletions
diff --git a/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/ConfigURI.java b/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/ConfigURI.java index c226405696..191005eafd 100644 --- a/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/ConfigURI.java +++ b/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/ConfigURI.java @@ -51,8 +51,10 @@ public class ConfigURI { private String multicastAddress = "224.5.12.10";
private int multicastPort = 51482;
private List<String> remotes = new ArrayList<String>();
+ private String uri;
public ConfigURI(String uri) {
+ this.uri = uri;
parseURI(uri);
}
@@ -154,5 +156,9 @@ public class ConfigURI { public List<String> getRemotes() {
return remotes;
}
+
+ public String toString() {
+ return uri;
+ }
}
diff --git a/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java b/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java index 54c1d1c0a5..a65c1a9c23 100644 --- a/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java +++ b/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java @@ -21,6 +21,7 @@ package org.apache.tuscany.sca.endpoint.hazelcast; import java.net.UnknownHostException;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -39,7 +40,6 @@ import com.hazelcast.config.TcpIpConfig; import com.hazelcast.config.XmlConfigBuilder;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
-import com.hazelcast.core.IMap;
import com.hazelcast.nio.Address;
/**
@@ -55,7 +55,7 @@ public class HazelcastEndpointRegistry implements EndpointRegistry, LifeCycleLis private ConfigURI configURI;
private HazelcastInstance hazelcastInstance;
- private IMap<Object, Object> map;
+ private Map<Object, Object> map;
private List<String> localEndpoints = new ArrayList<String>();;
public HazelcastEndpointRegistry(ExtensionPointRegistry registry,
@@ -70,12 +70,16 @@ public class HazelcastEndpointRegistry implements EndpointRegistry, LifeCycleLis if (map != null) {
throw new IllegalStateException("The registry has already been started");
}
- initHazelcastInstance();
- map = hazelcastInstance.getMap(configURI.getDomainName() + "Endpoints");
+ if (configURI.toString().startsWith("tuscany:vm:")) {
+ map = new HashMap<Object, Object>();
+ } else {
+ initHazelcastInstance();
+ map = hazelcastInstance.getMap(configURI.getDomainName() + "Endpoints");
+ }
}
public void stop() {
- if (map != null) {
+ if (hazelcastInstance != null) {
hazelcastInstance.shutdown();
}
}
@@ -187,7 +191,7 @@ public class HazelcastEndpointRegistry implements EndpointRegistry, LifeCycleLis if (endpointReference.getReference() != null) {
Endpoint targetEndpoint = endpointReference.getTargetEndpoint();
-
+
for (Object v : map.values()) {
Endpoint endpoint = (Endpoint)v;
logger.fine("Matching against - " + endpoint);
|