Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/node/internal/WatchManager.java24
1 files changed, 10 insertions, 14 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/node/internal/WatchManager.java b/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/node/internal/WatchManager.java
index 7c643e5d0..985fe3caf 100644
--- a/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/node/internal/WatchManager.java
+++ b/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/node/internal/WatchManager.java
@@ -75,25 +75,21 @@ public class WatchManager implements BundleStoppingListener {
nodeWriter.publish();
}
- public synchronized void publish(final AdvertisedService published) {
+ public void publish(AdvertisedService published) {
Assert.isNotNull(published);
String serviceid = published.getServiceID().getServiceTypeID()
.getInternal();
- if (WatchManager.this.getNodeWriters().containsKey(serviceid))
+ if (getNodeWriters().containsKey(serviceid))
return;
- if (!WatchManager.this.writeRootLock.isOpen()) {
- synchronized (WatchManager.this.writeRootLock) {
- try {
- /* wait for the server to get ready */
- WatchManager.this.writeRootLock.wait();
- } catch (InterruptedException e) {
- Logger.log(LogService.LOG_DEBUG, e.getMessage(), e);
- }
- }
+ try {
+ /* wait for the server to get ready */
+ while (!writeRootLock.isOpen())
+ Thread.sleep(300);
+ } catch (InterruptedException e) {
+ Logger.log(LogService.LOG_DEBUG, e.getMessage(), e);
}
- NodeWriter nodeWriter = new NodeWriter(published,
- WatchManager.this.writeRoot);
- WatchManager.this.getNodeWriters().put(serviceid, nodeWriter);
+ NodeWriter nodeWriter = new NodeWriter(published, writeRoot);
+ getNodeWriters().put(serviceid, nodeWriter);
allKnownServices.put(published.getServiceID().getName(), published);
nodeWriter.publish();
}

Back to the top