thetumbled opened a new issue, #4253:
URL: https://github.com/apache/bookkeeper/issues/4253
**BUG REPORT**
***Describe the bug***
The implementation is not consistent with the description of method `
org.apache.bookkeeper.client.BookKeeperAdmin#watchWritableBookiesChanged`.
We expect that when the available list of bookies changes, we can trigger
the listener. But actually, when i register a listener, the listener is
triggered immediately without any bookies changes.
Test code:
```
package org.example.Bookie;
import java.io.IOException;
import java.util.concurrent.CountDownLatch;
import org.apache.bookkeeper.client.BKException;
import org.apache.bookkeeper.client.BookKeeper;
import org.apache.bookkeeper.client.BookKeeperAdmin;
public class BookieAdmin {
public static void doSomething(CountDownLatch latch) {
System.out.println("Hello World");
latch.countDown();
}
public static void main(String[] args) throws BKException, IOException,
InterruptedException {
String zkConnectStringForTest = "XXX:2181";
BookKeeper bk = new BookKeeper(zkConnectStringForTest);
BookKeeperAdmin admin = new BookKeeperAdmin(bk);
CountDownLatch latch = new CountDownLatch(2);
System.out.println(admin.getAvailableBookies());
admin.watchWritableBookiesChanged(bookies -> doSomething(latch));
admin.watchReadOnlyBookiesChanged(bookies -> doSomething(latch));
latch.await();
admin.close();
bk.close();
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]