Browse files

Fix streaming without monitor

It will get config once and wait forever

Change-Id: I7e332451453d150c0c658c67f6db2fa454b791c6
Reviewed-on: http://review.couchbase.org/11970
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
  • Loading branch information...
1 parent bbae758 commit b6ca7a58f8c5ad4193bc5d787d5b6044af4de2d6 @avsej avsej committed with trondn Dec 30, 2011
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/main/java/org/couchbase/mock/http/PoolsHandler.java
View
10 src/main/java/org/couchbase/mock/http/PoolsHandler.java
@@ -16,8 +16,6 @@
package org.couchbase.mock.http;
import java.util.Observable;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.couchbase.mock.CouchbaseMock;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
@@ -32,6 +30,7 @@
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.couchbase.mock.Bucket;
+import org.couchbase.mock.CouchbaseMock.HarakiriMonitor;
/**
*
@@ -124,8 +123,11 @@ public void handle(HttpExchange exchange) throws IOException {
body.write("\n\n\n\n".getBytes());
body.flush();
CountDownLatch completed = new CountDownLatch(1);
- ConfigObserver observer = new ConfigObserver(bucket, body, completed);
- mock.getMonitor().addObserver(observer);
+ HarakiriMonitor monitor = mock.getMonitor();
+ if (monitor != null) {
+ ConfigObserver observer = new ConfigObserver(bucket, body, completed);
+ monitor.addObserver(observer);
+ } // else wait forever
try {
completed.await();
} catch (InterruptedException ex) {

0 comments on commit b6ca7a5

Please sign in to comment.