Package org.apache.bookkeeper.util
Class LocalBookKeeper
- java.lang.Object
-
- org.apache.bookkeeper.util.LocalBookKeeper
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class LocalBookKeeper extends java.lang.Object implements java.lang.AutoCloseable
Local Bookkeeper.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) ByteBufAllocatorWithOomHandler
allocator
static int
CONNECTION_TIMEOUT
(package private) java.util.List<java.io.File>
dirsToCleanUp
(package private) java.lang.String
dirSuffix
(package private) java.util.List<org.apache.bookkeeper.util.LocalBookKeeper.LocalBookie>
localBookies
(package private) java.io.File
localBookiesConfigDir
protected static org.slf4j.Logger
LOG
(package private) int
numberOfBookies
(package private) boolean
stopOnExit
(package private) java.lang.String
zkHost
(package private) int
zkPort
(package private) ZooKeeperServerShim
zks
-
Constructor Summary
Constructors Constructor Description LocalBookKeeper(int numberOfBookies, ServerConfiguration baseConf, java.lang.String localBookiesConfigDirName, boolean stopOnExit, java.lang.String dirSuffix, java.lang.String zkHost, int zkPort)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBookie()
void
close()
static LocalBookKeeper
getLocalBookies(java.lang.String zkHost, int zkPort, int numBookies, boolean shouldStartZK, ServerConfiguration conf)
static void
main(java.lang.String[] args)
void
removeBookie()
static ZooKeeperServerShim
runZookeeper(int maxCC, int zookeeperPort)
static ZooKeeperServerShim
runZookeeper(int maxCC, int zookeeperPort, java.io.File zkDir)
void
shutdownBookies()
void
start()
static boolean
waitForServerUp(java.lang.String hp, long timeout)
-
-
-
Field Detail
-
LOG
protected static final org.slf4j.Logger LOG
-
CONNECTION_TIMEOUT
public static final int CONNECTION_TIMEOUT
- See Also:
- Constant Field Values
-
numberOfBookies
int numberOfBookies
-
localBookies
java.util.List<org.apache.bookkeeper.util.LocalBookKeeper.LocalBookie> localBookies
-
zks
ZooKeeperServerShim zks
-
zkHost
java.lang.String zkHost
-
zkPort
int zkPort
-
dirSuffix
java.lang.String dirSuffix
-
allocator
ByteBufAllocatorWithOomHandler allocator
-
localBookiesConfigDir
java.io.File localBookiesConfigDir
-
dirsToCleanUp
java.util.List<java.io.File> dirsToCleanUp
-
stopOnExit
boolean stopOnExit
-
-
Constructor Detail
-
LocalBookKeeper
public LocalBookKeeper(int numberOfBookies, ServerConfiguration baseConf, java.lang.String localBookiesConfigDirName, boolean stopOnExit, java.lang.String dirSuffix, java.lang.String zkHost, int zkPort)
-
-
Method Detail
-
runZookeeper
public static ZooKeeperServerShim runZookeeper(int maxCC, int zookeeperPort) throws java.io.IOException
- Parameters:
maxCC
- Max Concurrency of ClientzookeeperPort
- ZooKeeper Server Port- Throws:
java.io.IOException
-
runZookeeper
public static ZooKeeperServerShim runZookeeper(int maxCC, int zookeeperPort, java.io.File zkDir) throws java.io.IOException
- Throws:
java.io.IOException
-
getLocalBookies
public static LocalBookKeeper getLocalBookies(java.lang.String zkHost, int zkPort, int numBookies, boolean shouldStartZK, ServerConfiguration conf) throws java.lang.Exception
- Throws:
java.lang.Exception
-
main
public static void main(java.lang.String[] args)
-
waitForServerUp
public static boolean waitForServerUp(java.lang.String hp, long timeout)
-
start
public void start() throws java.lang.Exception
- Throws:
java.lang.Exception
-
addBookie
public void addBookie() throws java.lang.Exception
- Throws:
java.lang.Exception
-
removeBookie
public void removeBookie() throws java.lang.Exception
- Throws:
java.lang.Exception
-
shutdownBookies
public void shutdownBookies() throws java.lang.Exception
- Throws:
java.lang.Exception
-
close
public void close() throws java.lang.Exception
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.lang.Exception
-
-