Class ControllerService
- java.lang.Object
- 
- org.apache.zookeeper.server.controller.ControllerService
 
- 
 public class ControllerService extends 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.
- 
- 
Field SummaryFields Modifier and Type Field Description protected QuorumPeerConfigconfigprotected QuorumPeerquorumPeer
 - 
Constructor SummaryConstructors Constructor Description ControllerService()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcleanup()protected voidinitConfig(String[] args)Derived classes may override to do custom initialization of command line args.voidinitializeAndRun(String[] args)Runs the main loop for this application but does not exit the process.protected voidinitService()Initializes an instance of the ZooKeeperServer, the ZooKeeperServerController, and a new Http listener (CommandListener) for the controller.booleanisReady()Is the service up with all necessary initialization and port opening complete?static voidmain(String[] args)Starts the ControllerService as a stand alone app.protected voidrun()voidrunFromConfig(QuorumPeerConfig config)Run the app given a QuorumPeerConfig.protected voidrunServices()voidshutdown()Threadstart(ControllerServerConfig controllerConfig)Starts a new thread to run the controller (useful when this service is hosted in process - such as during unit testing).
 
- 
- 
- 
Field Detail- 
configprotected QuorumPeerConfig config 
 - 
quorumPeerprotected QuorumPeer quorumPeer 
 
- 
 - 
Method Detail- 
mainpublic static void main(String[] args) Starts the ControllerService as a stand alone app. Useful for out of process testing - such as during integration testing.
 - 
startpublic 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).
 - 
shutdownpublic void shutdown() 
 - 
initServiceprotected void initService() throws IOExceptionInitializes an instance of the ZooKeeperServer, the ZooKeeperServerController, and a new Http listener (CommandListener) for the controller.- Throws:
- IOException
 
 - 
runServicesprotected void runServices() 
 - 
cleanupprotected void cleanup() 
 - 
initializeAndRunpublic void initializeAndRun(String[] args) throws QuorumPeerConfig.ConfigException Runs the main loop for this application but does not exit the process.- Throws:
- QuorumPeerConfig.ConfigException
 
 - 
initConfigprotected void initConfig(String[] args) throws QuorumPeerConfig.ConfigException Derived classes may override to do custom initialization of command line args.- Throws:
- QuorumPeerConfig.ConfigException
 
 - 
runFromConfigpublic void runFromConfig(QuorumPeerConfig config) Run the app given a QuorumPeerConfig.- Parameters:
- config- The quorum peer config.
 
 - 
runprotected void run() 
 - 
isReadypublic 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.
 
 
- 
 
-