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/command/FourLetterCommands.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.command; import java.nio.ByteBuffer; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * This class contains constants for all the four letter commands */ public class FourLetterCommands { /* * See <a href="{@docRoot}/../../../docs/zookeeperAdmin.html#sc_zkCommands"> * Zk Admin</a>. this link is for all the commands. */ public static final int confCmd = ByteBuffer.wrap("conf".getBytes()).getInt(); /* * See <a href="{@docRoot}/../../../docs/zookeeperAdmin.html#sc_zkCommands"> * Zk Admin</a>. this link is for all the commands. */ public static final int consCmd = ByteBuffer.wrap("cons".getBytes()).getInt(); /* * See <a href="{@docRoot}/../../../docs/zookeeperAdmin.html#sc_zkCommands"> * Zk Admin</a>. this link is for all the commands. */ public static final int crstCmd = ByteBuffer.wrap("crst".getBytes()).getInt(); /* * See <a href="{@docRoot}/../../../docs/zookeeperAdmin.html#sc_zkCommands"> * Zk Admin</a>. this link is for all the commands. */ public static final int dirsCmd = ByteBuffer.wrap("dirs".getBytes()).getInt(); /* * See <a href="{@docRoot}/../../../docs/zookeeperAdmin.html#sc_zkCommands"> * Zk Admin</a>. this link is for all the commands. */ public static final int dumpCmd = ByteBuffer.wrap("dump".getBytes()).getInt(); /* * See <a href="{@docRoot}/../../../docs/zookeeperAdmin.html#sc_zkCommands"> * Zk Admin</a>. this link is for all the commands. */ public static final int enviCmd = ByteBuffer.wrap("envi".getBytes()).getInt(); /* * See <a href="{@docRoot}/../../../docs/zookeeperAdmin.html#sc_zkCommands"> * Zk Admin</a>. this link is for all the commands. */ public static final int getTraceMaskCmd = ByteBuffer.wrap("gtmk".getBytes()).getInt(); /* * See <a href="{@docRoot}/../../../docs/zookeeperAdmin.html#sc_zkCommands"> * Zk Admin</a>. this link is for all the commands. */ public static final int ruokCmd = ByteBuffer.wrap("ruok".getBytes()).getInt(); /* * See <a href="{@docRoot}/../../../docs/zookeeperAdmin.html#sc_zkCommands"> * Zk Admin</a>. this link is for all the commands. */ public static final int setTraceMaskCmd = ByteBuffer.wrap("stmk".getBytes()).getInt(); /* * See <a href="{@docRoot}/../../../docs/zookeeperAdmin.html#sc_zkCommands"> * Zk Admin</a>. this link is for all the commands. */ public static final int srvrCmd = ByteBuffer.wrap("srvr".getBytes()).getInt(); /* * See <a href="{@docRoot}/../../../docs/zookeeperAdmin.html#sc_zkCommands"> * Zk Admin</a>. this link is for all the commands. */ public static final int srstCmd = ByteBuffer.wrap("srst".getBytes()).getInt(); /* * See <a href="{@docRoot}/../../../docs/zookeeperAdmin.html#sc_zkCommands"> * Zk Admin</a>. this link is for all the commands. */ public static final int statCmd = ByteBuffer.wrap("stat".getBytes()).getInt(); /* * See <a href="{@docRoot}/../../../docs/zookeeperAdmin.html#sc_zkCommands"> * Zk Admin</a>. this link is for all the commands. */ public static final int wchcCmd = ByteBuffer.wrap("wchc".getBytes()).getInt(); /* * See <a href="{@docRoot}/../../../docs/zookeeperAdmin.html#sc_zkCommands"> * Zk Admin</a>. this link is for all the commands. */ public static final int wchpCmd = ByteBuffer.wrap("wchp".getBytes()).getInt(); /* * See <a href="{@docRoot}/../../../docs/zookeeperAdmin.html#sc_zkCommands"> * Zk Admin</a>. this link is for all the commands. */ public static final int wchsCmd = ByteBuffer.wrap("wchs".getBytes()).getInt(); /* * See <a href="{@docRoot}/../../../docs/zookeeperAdmin.html#sc_zkCommands"> * Zk Admin</a>. this link is for all the commands. */ public static final int mntrCmd = ByteBuffer.wrap("mntr".getBytes()).getInt(); /* * See <a href="{@docRoot}/../../../docs/zookeeperAdmin.html#sc_zkCommands"> * Zk Admin</a>. this link is for all the commands. */ public static final int isroCmd = ByteBuffer.wrap("isro".getBytes()).getInt(); /* * See <a href="{@docRoot}/../../../docs/zookeeperAdmin.html#sc_zkCommands"> * Zk Admin</a>. this link is for all the commands. */ protected static final int hashCmd = ByteBuffer.wrap("hash".getBytes()).getInt(); /* * The control sequence sent by the telnet program when it closes a * connection. Include simply to keep the logs cleaner (the server would * close the connection anyway because it would parse this as a negative * length). */ public static final int telnetCloseCmd = 0xfff4fffd; private static final String ZOOKEEPER_4LW_COMMANDS_WHITELIST = "zookeeper.4lw.commands.whitelist"; private static final Logger LOG = LoggerFactory.getLogger(FourLetterCommands.class); private static final Map<Integer, String> cmd2String = new HashMap<Integer, String>(); private static final Set<String> whiteListedCommands = new HashSet<String>(); private static boolean whiteListInitialized = false; // @VisibleForTesting public static synchronized void resetWhiteList() { whiteListInitialized = false; whiteListedCommands.clear(); } /** * Return the string representation of the specified command code. */ public static String getCommandString(int command) { return cmd2String.get(command); } /** * Check if the specified command code is from a known command. * * @param command The integer code of command. * @return true if the specified command is known, false otherwise. */ public static boolean isKnown(int command) { return cmd2String.containsKey(command); } /** * Check if the specified command is enabled. * * In ZOOKEEPER-2693 we introduce a configuration option to only * allow a specific set of white listed commands to execute. * A command will only be executed if it is also configured * in the white list. * * @param command The command string. * @return true if the specified command is enabled */ public static synchronized boolean isEnabled(String command) { if (whiteListInitialized) { return whiteListedCommands.contains(command); } String commands = System.getProperty(ZOOKEEPER_4LW_COMMANDS_WHITELIST); if (commands != null) { String[] list = commands.split(","); for (String cmd : list) { if (cmd.trim().equals("*")) { for (Map.Entry<Integer, String> entry : cmd2String.entrySet()) { whiteListedCommands.add(entry.getValue()); } break; } if (!cmd.trim().isEmpty()) { whiteListedCommands.add(cmd.trim()); } } } // It is sad that isro and srvr are used by ZooKeeper itself. Need fix this // before deprecating 4lw. if (System.getProperty("readonlymode.enabled", "false").equals("true")) { whiteListedCommands.add("isro"); } // zkServer.sh depends on "srvr". whiteListedCommands.add("srvr"); whiteListInitialized = true; LOG.info("The list of known four letter word commands is : {}", Arrays.asList(cmd2String)); LOG.info("The list of enabled four letter word commands is : {}", Arrays.asList(whiteListedCommands)); return whiteListedCommands.contains(command); } // specify all of the commands that are available static { cmd2String.put(confCmd, "conf"); cmd2String.put(consCmd, "cons"); cmd2String.put(crstCmd, "crst"); cmd2String.put(dirsCmd, "dirs"); cmd2String.put(dumpCmd, "dump"); cmd2String.put(enviCmd, "envi"); cmd2String.put(getTraceMaskCmd, "gtmk"); cmd2String.put(ruokCmd, "ruok"); cmd2String.put(setTraceMaskCmd, "stmk"); cmd2String.put(srstCmd, "srst"); cmd2String.put(srvrCmd, "srvr"); cmd2String.put(statCmd, "stat"); cmd2String.put(wchcCmd, "wchc"); cmd2String.put(wchpCmd, "wchp"); cmd2String.put(wchsCmd, "wchs"); cmd2String.put(mntrCmd, "mntr"); cmd2String.put(isroCmd, "isro"); cmd2String.put(telnetCloseCmd, "telnet close"); cmd2String.put(hashCmd, "hash"); } }
⏎ org/apache/zookeeper/server/command/FourLetterCommands.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, 25647👍, 0💬
Popular Posts:
What JAR files are required to run sax\Writer.java provided in the Apache Xerces package? 1 JAR file...
JasperReports, the world's most popular open source business intelligence and reporting engine and J...
JDK 11 jdk.compiler.jmod is the JMOD file for JDK 11 Compiler tool, which can be invoked by the "jav...
What Is javaws.jar in JRE (Java Runtime Environment) 8? javaws.jar in JRE (Java Runtime Environment)...
JDK 11 java.naming.jmod is the JMOD file for JDK 11 Naming module. JDK 11 Naming module compiled cla...