Class ControllerService


  • public class ControllerService
    extends java.lang.Object
    Main class which starts a ZooKeeperServer, a ZooKeeperServerController and the ControllerService. Tests should either invoke this class as the main target of a new JVM process OR explicitly start and stop a singleton of this class in their test process.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void cleanup()  
      protected void initConfig​(java.lang.String[] args)
      Derived classes may override to do custom initialization of command line args.
      void initializeAndRun​(java.lang.String[] args)
      Runs the main loop for this application but does not exit the process.
      protected void initService()
      Initializes an instance of the ZooKeeperServer, the ZooKeeperServerController, and a new Http listener (CommandListener) for the controller.
      boolean isReady()
      Is the service up with all necessary initialization and port opening complete?
      static void main​(java.lang.String[] args)
      Starts the ControllerService as a stand alone app.
      protected void run()  
      void runFromConfig​(QuorumPeerConfig config)
      Run the app given a QuorumPeerConfig.
      protected void runServices()  
      void shutdown()  
      java.lang.Thread start​(ControllerServerConfig controllerConfig)
      Starts a new thread to run the controller (useful when this service is hosted in process - such as during unit testing).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ControllerService

        public ControllerService()
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
        Starts the ControllerService as a stand alone app. Useful for out of process testing - such as during integration testing.
      • start

        public java.lang.Thread start​(ControllerServerConfig controllerConfig)
        Starts a new thread to run the controller (useful when this service is hosted in process - such as during unit testing).
      • shutdown

        public void shutdown()
      • initService

        protected void initService()
                            throws java.io.IOException
        Initializes an instance of the ZooKeeperServer, the ZooKeeperServerController, and a new Http listener (CommandListener) for the controller.
        Throws:
        java.io.IOException
      • runServices

        protected void runServices()
      • cleanup

        protected void cleanup()
      • runFromConfig

        public void runFromConfig​(QuorumPeerConfig config)
        Run the app given a QuorumPeerConfig.
        Parameters:
        config - The quorum peer config.
      • run

        protected void run()
      • isReady

        public boolean isReady()
        Is the service up with all necessary initialization and port opening complete?
        Returns:
        true if the controller service is ready to use; false otherwise.