diff options
Diffstat (limited to 'sca-java-2.x/trunk')
2 files changed, 20 insertions, 5 deletions
diff --git a/sca-java-2.x/trunk/modules/endpoint-dht/src/main/java/org/apache/tuscany/sca/endpoint/dht/OverlayEndpointRegistry.java b/sca-java-2.x/trunk/modules/endpoint-dht/src/main/java/org/apache/tuscany/sca/endpoint/dht/OverlayEndpointRegistry.java index 015cf64c39..f6fa1f3bfb 100644 --- a/sca-java-2.x/trunk/modules/endpoint-dht/src/main/java/org/apache/tuscany/sca/endpoint/dht/OverlayEndpointRegistry.java +++ b/sca-java-2.x/trunk/modules/endpoint-dht/src/main/java/org/apache/tuscany/sca/endpoint/dht/OverlayEndpointRegistry.java @@ -327,4 +327,8 @@ public class OverlayEndpointRegistry implements EndpointRegistry, LifeCycleListe } } + public List<EndpointReference> getEndpointReferences() { + return endpointreferences; + } + } diff --git a/sca-java-2.x/trunk/modules/endpoint-zookeeper/src/main/java/org/apache/tuscany/sca/endpoint/zookeeper/DistributedRegistry.java b/sca-java-2.x/trunk/modules/endpoint-zookeeper/src/main/java/org/apache/tuscany/sca/endpoint/zookeeper/DistributedRegistry.java index b6ec34fe1f..b000640e18 100644 --- a/sca-java-2.x/trunk/modules/endpoint-zookeeper/src/main/java/org/apache/tuscany/sca/endpoint/zookeeper/DistributedRegistry.java +++ b/sca-java-2.x/trunk/modules/endpoint-zookeeper/src/main/java/org/apache/tuscany/sca/endpoint/zookeeper/DistributedRegistry.java @@ -53,6 +53,8 @@ public class DistributedRegistry extends AbstractDistributedMap<Endpoint> implem private ExtensionPointRegistry registry; private String domainURI; private String registryURI; + private String hosts = null; + private int sessionTimeout = 100; /** * @@ -64,12 +66,17 @@ public class DistributedRegistry extends AbstractDistributedMap<Endpoint> implem super(null, null, null); this.domainURI = domainURI; this.registryURI = domainRegistryURI; - Map<String, String> config = parseURI(attributes, domainRegistryURI); + Map<String, String> config = parseURI(attributes, registryURI); + hosts = config.get("hosts"); + String timeout = config.get("sessionTimeout"); + if (timeout != null) { + sessionTimeout = Integer.parseInt(timeout.trim()); + } } public void start() { try { - zooKeeper = new ZooKeeper(registryURI, 100, null); + zooKeeper = new ZooKeeper(registryURI, sessionTimeout, null); } catch (IOException e) { throw new ServiceRuntimeException(e); } @@ -188,7 +195,7 @@ public class DistributedRegistry extends AbstractDistributedMap<Endpoint> implem logger.fine("Matching against - " + endpoint); if (matches(targetEndpoint.getURI(), endpoint.getURI())) { // if (!entry.isPrimary()) { - ((RuntimeEndpoint) endpoint).bind(registry, this); + ((RuntimeEndpoint)endpoint).bind(registry, this); // } foundEndpoints.add(endpoint); logger.fine("Found endpoint with matching service - " + endpoint); @@ -242,7 +249,7 @@ public class DistributedRegistry extends AbstractDistributedMap<Endpoint> implem } public void entryAdded(Endpoint value) { - ((RuntimeEndpoint) value).bind(registry, this); + ((RuntimeEndpoint)value).bind(registry, this); for (EndpointListener listener : listeners) { listener.endpointAdded(value); } @@ -255,7 +262,7 @@ public class DistributedRegistry extends AbstractDistributedMap<Endpoint> implem } public void entryUpdated(Endpoint oldEp, Endpoint newEp) { - ((RuntimeEndpoint) newEp).bind(registry, this); + ((RuntimeEndpoint)newEp).bind(registry, this); for (EndpointListener listener : listeners) { listener.endpointUpdated(oldEp, newEp); } @@ -282,4 +289,8 @@ public class DistributedRegistry extends AbstractDistributedMap<Endpoint> implem } } + public List<EndpointReference> getEndpointReferences() { + return endpointreferences; + } + } |