diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-05 23:01:06 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-05 23:01:06 +0000 |
commit | 7100b31b4fc3501b6c465dbc977548a386d323cf (patch) | |
tree | 384ebf4f8e1c7ebaf2509a3b630757fc1e7f0091 /sca-java-2.x/trunk/modules/endpoint-zookeeper | |
parent | 83a03558455f4deb93628741ad91e7d063518e56 (diff) |
Add getEndpointReferences
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@896261 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/endpoint-zookeeper')
-rw-r--r-- | sca-java-2.x/trunk/modules/endpoint-zookeeper/src/main/java/org/apache/tuscany/sca/endpoint/zookeeper/DistributedRegistry.java | 21 |
1 files changed, 16 insertions, 5 deletions
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; + } + } |