Package org.apache.bookkeeper.meta
Class AbstractZkLedgerManagerFactory
- java.lang.Object
-
- org.apache.bookkeeper.meta.AbstractZkLedgerManagerFactory
-
- All Implemented Interfaces:
java.lang.AutoCloseable,LedgerManagerFactory
- Direct Known Subclasses:
FlatLedgerManagerFactory,LegacyHierarchicalLedgerManagerFactory,MSLedgerManagerFactory
public abstract class AbstractZkLedgerManagerFactory extends java.lang.Object implements LedgerManagerFactory
Abstract ledger manager factory based on zookeeper, which provides common methods such as format and validateAndNukeExistingCluster.
-
-
Constructor Summary
Constructors Constructor Description AbstractZkLedgerManagerFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static LedgerManagerFactorycreateNewLMFactory(AbstractConfiguration conf, LayoutManager layoutManager, java.lang.Class<? extends LedgerManagerFactory> factoryClass)Creates the new layout and stores in zookeeper and returns the LedgerManagerFactory instance.voidformat(AbstractConfiguration<?> conf, LayoutManager layoutManager)Format the ledger metadata for LedgerManager.static LedgerManagerFactorynewLedgerManagerFactory(AbstractConfiguration<?> conf, LayoutManager layoutManager)Create new Ledger Manager Factory.booleanvalidateAndNukeExistingCluster(AbstractConfiguration<?> conf, LayoutManager layoutManager)This method makes sure there are no unexpected znodes under ledgersRootPath and then it proceeds with ledger metadata formatting and nuking the cluster ZK state info.-
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.LedgerManagerFactory
close, getCurrentVersion, initialize, newLedgerAuditorManager, newLedgerIdGenerator, newLedgerManager, newLedgerUnderreplicationManager
-
-
-
-
Field Detail
-
zk
protected org.apache.zookeeper.ZooKeeper zk
-
V1
static final int V1
- See Also:
- Constant Field Values
-
-
Method Detail
-
format
public void format(AbstractConfiguration<?> conf, LayoutManager layoutManager) throws java.lang.InterruptedException, org.apache.zookeeper.KeeperException, java.io.IOException
Description copied from interface:LedgerManagerFactoryFormat the ledger metadata for LedgerManager.- Specified by:
formatin interfaceLedgerManagerFactory- Parameters:
conf- Configuration instancelayoutManager- Layout manager- Throws:
java.lang.InterruptedExceptionorg.apache.zookeeper.KeeperExceptionjava.io.IOException
-
validateAndNukeExistingCluster
public boolean validateAndNukeExistingCluster(AbstractConfiguration<?> conf, LayoutManager layoutManager) throws java.lang.InterruptedException, org.apache.zookeeper.KeeperException, java.io.IOException
Description copied from interface:LedgerManagerFactoryThis method makes sure there are no unexpected znodes under ledgersRootPath and then it proceeds with ledger metadata formatting and nuking the cluster ZK state info.- Specified by:
validateAndNukeExistingClusterin interfaceLedgerManagerFactory- Parameters:
conf- Configuration instancelayoutManager- Layout manager- Throws:
java.lang.InterruptedExceptionorg.apache.zookeeper.KeeperExceptionjava.io.IOException
-
newLedgerManagerFactory
public static LedgerManagerFactory newLedgerManagerFactory(AbstractConfiguration<?> conf, LayoutManager layoutManager) throws java.io.IOException, java.lang.InterruptedException
Create new Ledger Manager Factory.- Parameters:
conf- Configuration Object.layoutManager- layout manager- Returns:
- new ledger manager factory
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
createNewLMFactory
protected static LedgerManagerFactory createNewLMFactory(AbstractConfiguration conf, LayoutManager layoutManager, java.lang.Class<? extends LedgerManagerFactory> factoryClass) throws java.io.IOException, java.lang.InterruptedException
Creates the new layout and stores in zookeeper and returns the LedgerManagerFactory instance.- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
-