Package org.apache.bookkeeper.discover
Class ZKRegistrationClient
java.lang.Object
org.apache.bookkeeper.discover.ZKRegistrationClient
- All Implemented Interfaces:
AutoCloseable,RegistrationClient
ZooKeeper based
RegistrationClient.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.apache.bookkeeper.discover.RegistrationClient
RegistrationClient.RegistrationListener -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionZKRegistrationClient(org.apache.zookeeper.ZooKeeper zk, String ledgersRootPath, ScheduledExecutorService scheduler, boolean bookieAddressTracking) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()(package private) static BookieServiceInfodeserializeBookieServiceInfo(BookieId bookieId, byte[] bookieServiceInfo) Get the list of all bookies identifiers.getBookieServiceInfo(BookieId bookieId) Get detailed information about the services exposed by a Bookie.Get the list of readonly bookie identifiers.(package private) ZKRegistrationClient.WatchTask(package private) ZKRegistrationClient.WatchTaskGet the list of writable bookie identifiers.org.apache.zookeeper.ZooKeepergetZk()booleanvoidUnwatch the changes of bookies.voidUnwatch the changes of bookies.Watch the changes of bookies.Watch the changes of bookies.
-
Field Details
-
ZK_CONNECT_BACKOFF_MS
static final int ZK_CONNECT_BACKOFF_MS- See Also:
-
-
Constructor Details
-
ZKRegistrationClient
public ZKRegistrationClient(org.apache.zookeeper.ZooKeeper zk, String ledgersRootPath, ScheduledExecutorService scheduler, boolean bookieAddressTracking)
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceRegistrationClient
-
isBookieAddressTracking
public boolean isBookieAddressTracking() -
getZk
public org.apache.zookeeper.ZooKeeper getZk() -
getWritableBookies
Description copied from interface:RegistrationClientGet the list of writable bookie identifiers.- Specified by:
getWritableBookiesin interfaceRegistrationClient- Returns:
- a future represents the list of writable bookies.
-
getAllBookies
Description copied from interface:RegistrationClientGet the list of all bookies identifiers.- Specified by:
getAllBookiesin interfaceRegistrationClient- Returns:
- a future represents the list of all bookies.
-
getReadOnlyBookies
Description copied from interface:RegistrationClientGet the list of readonly bookie identifiers.- Specified by:
getReadOnlyBookiesin interfaceRegistrationClient- Returns:
- a future represents the list of readonly bookies.
-
getBookieServiceInfo
Description copied from interface:RegistrationClientGet detailed information about the services exposed by a Bookie. For old bookies it is expected to return an empty BookieServiceInfo structure.- Specified by:
getBookieServiceInfoin interfaceRegistrationClient- Parameters:
bookieId- this is the id of the bookie, it can be computed from aBookieId- Returns:
- a future represents the available information.
-
deserializeBookieServiceInfo
static BookieServiceInfo deserializeBookieServiceInfo(BookieId bookieId, byte[] bookieServiceInfo) throws IOException - Throws:
IOException
-
watchWritableBookies
public CompletableFuture<Void> watchWritableBookies(RegistrationClient.RegistrationListener listener) Description copied from interface:RegistrationClientWatch the changes of bookies.The topology changes of bookies will be propagated to the provided listener.
- Specified by:
watchWritableBookiesin interfaceRegistrationClient- Parameters:
listener- listener to receive the topology changes of bookies.- Returns:
- a future which completes when the bookies have been read for the first time
-
unwatchWritableBookies
Description copied from interface:RegistrationClientUnwatch the changes of bookies.- Specified by:
unwatchWritableBookiesin interfaceRegistrationClient- Parameters:
listener- listener to receive the topology changes of bookies.
-
watchReadOnlyBookies
public CompletableFuture<Void> watchReadOnlyBookies(RegistrationClient.RegistrationListener listener) Description copied from interface:RegistrationClientWatch the changes of bookies.The topology changes of bookies will be propagated to the provided listener.
- Specified by:
watchReadOnlyBookiesin interfaceRegistrationClient- Parameters:
listener- listener to receive the topology changes of bookies.- Returns:
- a future which completes when the bookies have been read for the first time
-
unwatchReadOnlyBookies
Description copied from interface:RegistrationClientUnwatch the changes of bookies.- Specified by:
unwatchReadOnlyBookiesin interfaceRegistrationClient- Parameters:
listener- listener to receive the topology changes of bookies.
-
getWatchWritableBookiesTask
ZKRegistrationClient.WatchTask getWatchWritableBookiesTask() -
getWatchReadOnlyBookiesTask
ZKRegistrationClient.WatchTask getWatchReadOnlyBookiesTask()
-