Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
Apache ZooKeeper 3.7.0 Server Source Code
Apache ZooKeeper is an open-source server which enables highly
reliable distributed coordination.
Apache ZooKeeper Server Source Code files are provided in the source packge (apache-zookeeper-3.7.0.tar.gz). You can download it at Apache ZooKeeper Website.
You can also browse Apache ZooKeeper Server Source Code below:
✍: FYIcenter.com
⏎ org/apache/zookeeper/server/controller/ControllerService.java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.zookeeper.server.controller; import java.io.IOException; import org.apache.zookeeper.server.ExitCode; import org.apache.zookeeper.server.ServerCnxnFactory; import org.apache.zookeeper.server.quorum.QuorumPeer; import org.apache.zookeeper.server.quorum.QuorumPeerConfig; import org.apache.zookeeper.util.ServiceUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * 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. */ public class ControllerService { private static final Logger LOG = LoggerFactory.getLogger(ControllerService.class); private ZooKeeperServerController controller; private CommandListener listener; protected QuorumPeerConfig config; private ServerCnxnFactory serverCnxnFactory = null; protected QuorumPeer quorumPeer = null; /** * Starts the ControllerService as a stand alone app. Useful for out of process testing * - such as during integration testing. */ public static void main(String[] args) { ControllerServerConfig config; try { if (args.length != 1) { throw new IllegalArgumentException("Require config file as cmd line argument"); } else { config = new ControllerServerConfig(args[0]); } new ControllerService().start(config); } catch (Exception ex) { System.err.println(ex.getMessage()); System.err.println("Usage: TestControllerMain controller-port configfile"); ServiceUtils.requestSystemExit(ExitCode.UNEXPECTED_ERROR.getValue()); } } /** * Starts a new thread to run the controller (useful when this service is hosted in process * - such as during unit testing). */ public Thread start(ControllerServerConfig controllerConfig) { this.config = controllerConfig; final ControllerService svc = this; Thread runner = new Thread(() -> { try { svc.run(); } catch (Exception e) { } }); runner.setDaemon(true); runner.start(); return runner; } public synchronized void shutdown() { if (listener != null) { listener.close(); listener = null; } if (controller != null) { controller.shutdown(); controller = null; } } /** * Initializes an instance of the ZooKeeperServer, the ZooKeeperServerController, and a new * Http listener (CommandListener) for the controller. */ protected void initService() throws IOException { ControllerServerConfig controllerConfig = (ControllerServerConfig) config; controllerConfig.ensureComplete(); this.controller = new ZooKeeperServerController(controllerConfig); this.listener = new CommandListener(controller, controllerConfig); this.serverCnxnFactory = controller.getCnxnFactory(); } protected void runServices() { this.controller.run(); } protected void cleanup() { if (listener != null) { listener.close(); listener = null; } } /** * Runs the main loop for this application but does not exit the process. */ public void initializeAndRun(String[] args) throws QuorumPeerConfig.ConfigException { initConfig(args); run(); } /** * Derived classes may override to do custom initialization of command line args. */ protected void initConfig(String[] args) throws QuorumPeerConfig.ConfigException { if (args.length == 1) { config.parse(args[0]); } } /** * Run the app given a QuorumPeerConfig. * * @param config The quorum peer config. */ public void runFromConfig(QuorumPeerConfig config) { LOG.info("Starting quorum peer from peer config"); this.config = config; run(); } protected void run() { try { initService(); } catch (Exception ex) { LOG.error("Failed to start ControllerService.", ex); ServiceUtils.requestSystemExit(ExitCode.UNEXPECTED_ERROR.getValue()); } runServices(); cleanup(); } /** * Is the service up with all necessary initialization and port opening complete? * * @return true if the controller service is ready to use; false otherwise. */ public boolean isReady() { return controller != null && controller.isReady(); } }
⏎ org/apache/zookeeper/server/controller/ControllerService.java
Or download all of them as a single archive file:
File name: zookeeper-server-3.7.0-fyi.zip File size: 871011 bytes Release date: 2021-05-17 Download
⇒ Apache ZooKeeper 3.7.0 Jute Source Code
⇐ Download Apache ZooKeeper 3.7.0 Source Package
2022-11-16, 24733👍, 0💬
Popular Posts:
A stream buffer is a stream-based representation of an XML infoset in Java. Stream buffers are desig...
What Is commons-net-ftp-2.0.jar? commons-net-ftp-2.0.jar is the JAR file for Apache Commons Net FTP ...
JDK 11 java.sql.rowset.jmod is the JMOD file for JDK 11 SQL Rowset module. JDK 11 SQL Rowset module ...
Apache Axis2 is the core engine for Web services. It is a complete re-design and re-write of the wid...
JDK 11 jdk.xml.dom.jmod is the JMOD file for JDK 11 XML DOM module. JDK 11 XML DOM module compiled c...