Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
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 (322)
Collections:
Other Resources:
Apache ZooKeeper 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 package file, apache-zookeeper-3.8.0.tar.gz.
You can download apache-zookeeper-3.8.0.tar.gz as described in the previous tutorial and go to the "zookeeper-server" sub-folder to view Apache ZooKeeper Server Source Code files.
You can also browse Apache ZooKeeper Server Source Code below:
✍: FYIcenter.com
⏎ org/apache/zookeeper/server/controller/ControlCommand.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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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;
/**
* Set of commands that this controller can execute. Commands are comprised
* of an action and an optional parameter specific to that action.
*/
public class ControlCommand {
/**
* Actions available to the controller
*/
public enum Action {
// Simple "are you there" ping to confirm the controller is up and running.
PING,
// Shutdown everything, including CommandListener, ControllerService, Controller and the ZooKeeperServer.
SHUTDOWN,
// Close a connection triggering a client disconnect (and then reconnect attempt).
// No parameter indicates close all connections. Optional parameter indicates a specific session id (as long).
CLOSECONNECTION,
// More actions go here in the future (force drop sessions, etc).
EXPIRESESSION,
// Reject all future connections. No parameter required.
REJECTCONNECTIONS,
// Add latency to server replies.
// Optional parameter indicates time in milliseconds to delay
// (default = 1 second).
ADDDELAY,
// Fail requests.
// Optional parameter indicates how many requests to fail.
// (default = all requests until RESET).
FAILREQUESTS,
// Process requests but do not send a response.
// Optional parameter indicates how many requests to fail.
// (default = all requests until RESET).
NORESPONSE,
// No parameter indicates fail all requests.
// Optional parameter indicates undo all the chaotic action commands
// (reject connections, add delay, fail requests, eat requests and so on...).
RESET,
// Force the quorum to elect a new leader.
ELECTNEWLEADER,
// More actions go here in the future...
}
public static final String ENDPOINT = "command";
public static final String ENDPOINT_PREFIX = ENDPOINT + "/";
private Action action;
public Action getAction() {
return action;
}
private String parameter;
protected String getParameter() {
return parameter;
}
public ControlCommand(Action action) {
this(action, null);
}
public ControlCommand(Action action, String param) {
this.action = action;
this.parameter = param;
}
/**
* Create a REST command uri.
* @param action The 'verb' of the command.
* @param parameter The optional parameter.
* @return A string to send to the server as the end of the Uri.
*/
public static String createCommandUri(Action action, String parameter) {
return ENDPOINT_PREFIX + action.toString() + (parameter != null && !parameter.isEmpty() ? "/" + parameter : "");
}
/**
* Parse a Uri into the required Command action and parameter.
* @param commandUri the properly formatted Uri.
*/
public static ControlCommand parseUri(String commandUri) {
if (commandUri == null) {
throw new IllegalArgumentException("commandUri can't be null.");
}
if (!commandUri.startsWith(ENDPOINT_PREFIX)) {
throw new IllegalArgumentException("Missing required prefix: " + ENDPOINT_PREFIX);
}
String uri = commandUri.substring(ENDPOINT_PREFIX.length());
String name;
String param;
int separatorIndex = uri.indexOf('/');
if (separatorIndex < 0) {
name = uri;
param = null;
} else {
name = uri.substring(0, separatorIndex);
param = uri.substring(separatorIndex + 1);
}
return new ControlCommand(Action.valueOf(name.toUpperCase()), param);
}
}
⏎ org/apache/zookeeper/server/controller/ControlCommand.java
Or download all of them as a single archive file:
File name: zookeeper-server-3.8.0-fyi.zip File size: 885581 bytes Release date: 2022-02-25 Download
⇒ Apache ZooKeeper Jute Source Code
⇐ Download and Install Apache ZooKeeper Source Package
2022-11-16, ≈117🔥, 0💬
Popular Posts:
How to perform XML Schema validation with dom\Writer.java provided in the Apache Xerces package? You...
Apache Log4j Core Implementation provides the functional components of the logging system. Users are...
JDK 11 jdk.crypto.ec.jmod is the JMOD file for JDK 11 Crypto EC module. JDK 11 Crypto EC module comp...
JDK 11 java.sql.jmod is the JMOD file for JDK 11 SQL (Structured Query Language) module. JDK 11 SQL ...
JDK 17 java.xml.crypto.jmod is the JMOD file for JDK 17 XML (eXtensible Markup Language) Crypto modu...