Class BKCluster
- java.lang.Object
-
- org.apache.pulsar.metadata.bookkeeper.BKCluster
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class BKCluster extends java.lang.Object implements java.lang.AutoCloseableA class runs several bookie servers for testing.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.bookkeeper.conf.ClientConfigurationbaseClientConfprotected org.apache.bookkeeper.conf.ServerConfigurationbaseConf
-
Constructor Summary
Constructors Constructor Description BKCluster(java.lang.String metadataServiceUri, int numBookies)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcleanupTempDirs()voidclose()static org.apache.bookkeeper.conf.ClientConfigurationnewBaseClientConfiguration()org.apache.bookkeeper.client.BookKeepernewClient()protected voidstartAllBookies()protected org.apache.bookkeeper.proto.BookieServerstartBookie(org.apache.bookkeeper.conf.ServerConfiguration conf)Helper method to startup a bookie server using a configuration object.intstartNewBookie()Helper method to startup a new bookie server with the indicated port number.protected voidstopAllBookies()protected voidstopAllBookies(boolean shutdownClient)protected voidstopBKCluster()Stop cluster.
-
-
-
Method Detail
-
close
public void close() throws java.lang.Exception- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.lang.Exception
-
newClient
public org.apache.bookkeeper.client.BookKeeper newClient() throws java.lang.Exception- Throws:
java.lang.Exception
-
stopBKCluster
protected void stopBKCluster() throws java.lang.ExceptionStop cluster. Also, stops all the auto recovery processes for the bookie cluster, if isAutoRecoveryEnabled is true.- Throws:
java.lang.Exception
-
cleanupTempDirs
protected void cleanupTempDirs() throws java.lang.Exception- Throws:
java.lang.Exception
-
stopAllBookies
protected void stopAllBookies() throws java.lang.Exception- Throws:
java.lang.Exception
-
stopAllBookies
protected void stopAllBookies(boolean shutdownClient) throws java.lang.Exception- Throws:
java.lang.Exception
-
startAllBookies
protected void startAllBookies() throws java.lang.Exception- Throws:
java.lang.Exception
-
startNewBookie
public int startNewBookie() throws java.lang.ExceptionHelper method to startup a new bookie server with the indicated port number. Also, starts the auto recovery process, if the isAutoRecoveryEnabled is set true.- Throws:
java.io.IOExceptionjava.lang.Exception
-
startBookie
protected org.apache.bookkeeper.proto.BookieServer startBookie(org.apache.bookkeeper.conf.ServerConfiguration conf) throws java.lang.ExceptionHelper method to startup a bookie server using a configuration object. Also, starts the auto recovery process if isAutoRecoveryEnabled is true.- Parameters:
conf- Server Configuration Object- Throws:
java.lang.Exception
-
newBaseClientConfiguration
public static org.apache.bookkeeper.conf.ClientConfiguration newBaseClientConfiguration()
-
-