Class BKCluster

java.lang.Object
org.apache.pulsar.metadata.bookkeeper.BKCluster
All Implemented Interfaces:
AutoCloseable

public class BKCluster extends Object implements AutoCloseable
A class runs several bookie servers for testing.
  • Field Details

    • baseConf

      protected final org.apache.bookkeeper.conf.ServerConfiguration baseConf
    • baseClientConf

      protected final org.apache.bookkeeper.conf.ClientConfiguration baseClientConf
  • Method Details

    • builder

      public static BKCluster.BKClusterConf builder()
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception
    • newClient

      public org.apache.bookkeeper.client.BookKeeper newClient() throws Exception
      Throws:
      Exception
    • stopBKCluster

      protected void stopBKCluster() throws Exception
      Stop cluster. Also, stops all the auto recovery processes for the bookie cluster, if isAutoRecoveryEnabled is true.
      Throws:
      Exception
    • cleanupTempDirs

      protected void cleanupTempDirs() throws Exception
      Throws:
      Exception
    • stopAllBookies

      protected void stopAllBookies() throws Exception
      Throws:
      Exception
    • stopAllBookies

      protected void stopAllBookies(boolean shutdownClient) throws Exception
      Throws:
      Exception
    • startAllBookies

      protected void startAllBookies() throws Exception
      Throws:
      Exception
    • startNewBookie

      public int startNewBookie(int index) throws Exception
      Helper method to startup a new bookie server with the indicated port number. Also, starts the auto recovery process, if the isAutoRecoveryEnabled is set true.
      Parameters:
      index - Bookie index
      Throws:
      IOException
      Exception
    • startBookie

      protected org.apache.bookkeeper.common.component.LifecycleComponentStack startBookie(org.apache.bookkeeper.conf.ServerConfiguration conf) throws Exception
      Helper 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:
      Exception
    • newBaseClientConfiguration

      public static org.apache.bookkeeper.conf.ClientConfiguration newBaseClientConfiguration()