Package org.apache.bookkeeper.meta.zk
Class ZKMetadataClientDriver
- java.lang.Object
-
- org.apache.bookkeeper.meta.zk.ZKMetadataDriverBase
-
- org.apache.bookkeeper.meta.zk.ZKMetadataClientDriver
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,MetadataClientDriver
public class ZKMetadataClientDriver extends ZKMetadataDriverBase implements MetadataClientDriver
ZooKeeper based metadata client driver.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.bookkeeper.meta.MetadataClientDriver
MetadataClientDriver.SessionStateListener
-
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean
bookieAddressTracking
(package private) ClientConfiguration
clientConf
(package private) RegistrationClient
regClient
(package private) java.util.concurrent.ScheduledExecutorService
scheduler
-
Fields inherited from class org.apache.bookkeeper.meta.zk.ZKMetadataDriverBase
acls, conf, disableHealthCheckPath, layoutManager, ledgersRootPath, lmFactory, metadataServiceAvailable, ownZKHandle, SCHEME, statsLogger, zk
-
-
Constructor Summary
Constructors Constructor Description ZKMetadataClientDriver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
RegistrationClient
getRegistrationClient()
Return the registration client used for discovering registered bookies.MetadataClientDriver
initialize(ClientConfiguration conf, java.util.concurrent.ScheduledExecutorService scheduler, StatsLogger statsLogger, java.util.Optional<java.lang.Object> optionalCtx)
Initialize the metadata driver.java.util.concurrent.CompletableFuture<java.lang.Boolean>
isMetadataServiceAvailable()
Return driver metadata service is available.(package private) ZKRegistrationClient
newZKRegistrationClient(org.apache.zookeeper.ZooKeeper zk, java.lang.String ledgersRootPath, java.util.concurrent.ScheduledExecutorService scheduler, boolean bookieAddressTracking)
void
setSessionStateListener(MetadataClientDriver.SessionStateListener sessionStateListener)
sets session state listener.-
Methods inherited from class org.apache.bookkeeper.meta.zk.ZKMetadataDriverBase
disableHealthCheck, enableHealthCheck, getLayoutManager, getLedgerManagerFactory, getScheme, getZk, getZKServersFromServiceUri, initialize, isHealthCheckEnabled, resolveLedgerManagerFactory, resolveZkLedgersRootPath, resolveZkServers, setZk
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.bookkeeper.meta.MetadataClientDriver
getLayoutManager, getLedgerManagerFactory, getScheme, isHealthCheckEnabled
-
-
-
-
Field Detail
-
clientConf
ClientConfiguration clientConf
-
scheduler
java.util.concurrent.ScheduledExecutorService scheduler
-
regClient
RegistrationClient regClient
-
bookieAddressTracking
boolean bookieAddressTracking
-
-
Method Detail
-
initialize
public MetadataClientDriver initialize(ClientConfiguration conf, java.util.concurrent.ScheduledExecutorService scheduler, StatsLogger statsLogger, java.util.Optional<java.lang.Object> optionalCtx) throws MetadataException
Description copied from interface:MetadataClientDriver
Initialize the metadata driver.- Specified by:
initialize
in interfaceMetadataClientDriver
- Parameters:
conf
- configurationscheduler
- schedulerstatsLogger
- stats loggeroptionalCtx
- optional context object passed in for initialization. currently it is an external zookeeper instance, which can be used for zookeeper based metadata implementation.- Returns:
- metadata driver
- Throws:
MetadataException
- when fail to initialize the client driver.
-
getRegistrationClient
public RegistrationClient getRegistrationClient()
Description copied from interface:MetadataClientDriver
Return the registration client used for discovering registered bookies.- Specified by:
getRegistrationClient
in interfaceMetadataClientDriver
- Returns:
- the registration client used for discovering registered bookies.
-
newZKRegistrationClient
ZKRegistrationClient newZKRegistrationClient(org.apache.zookeeper.ZooKeeper zk, java.lang.String ledgersRootPath, java.util.concurrent.ScheduledExecutorService scheduler, boolean bookieAddressTracking)
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceMetadataClientDriver
- Overrides:
close
in classZKMetadataDriverBase
-
setSessionStateListener
public void setSessionStateListener(MetadataClientDriver.SessionStateListener sessionStateListener)
Description copied from interface:MetadataClientDriver
sets session state listener.- Specified by:
setSessionStateListener
in interfaceMetadataClientDriver
- Parameters:
sessionStateListener
- listener listening on metadata client session states.
-
isMetadataServiceAvailable
public java.util.concurrent.CompletableFuture<java.lang.Boolean> isMetadataServiceAvailable()
Description copied from interface:MetadataClientDriver
Return driver metadata service is available.- Specified by:
isMetadataServiceAvailable
in interfaceMetadataClientDriver
- Returns:
- the metadata service is available.
-
-