HDFS-13341. Ozone: Move ozone specific ServiceRuntimeInfo utility to the framework. Contributed by Elek, Marton.
This commit is contained in:
parent
12c3e4ef98
commit
4f37ff7616
@ -54,7 +54,7 @@
|
||||
|
||||
import static org.apache.hadoop.cblock.CblockUtils.getCblockServerRpcAddr;
|
||||
import static org.apache.hadoop.cblock.CblockUtils.getCblockServiceRpcAddr;
|
||||
import static org.apache.hadoop.ozone.web.util.ServerUtils
|
||||
import static org.apache.hadoop.hdsl.server.ServerUtils
|
||||
.updateRPCListenAddress;
|
||||
import org.iq80.leveldb.DBIterator;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -31,7 +31,7 @@
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.apache.hadoop.hdsl.HdslUtils.*;
|
||||
import static org.apache.hadoop.ozone.web.util.ServerUtils.sanitizeUserArgs;
|
||||
import static org.apache.hadoop.hdsl.server.ServerUtils.sanitizeUserArgs;
|
||||
import static org.apache.hadoop.scm.ScmConfigKeys.*;
|
||||
|
||||
/**
|
||||
|
24
hadoop-hdsl/framework/README.md
Normal file
24
hadoop-hdsl/framework/README.md
Normal file
@ -0,0 +1,24 @@
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
# Server framework for HDSL/Ozone
|
||||
|
||||
This project contains generic utilities and resources for all the HDSL/Ozone
|
||||
server-side components.
|
||||
|
||||
The project is shared between the server/service projects but not with the
|
||||
client packages.
|
@ -15,7 +15,7 @@
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.ozone.web;
|
||||
package org.apache.hadoop.hdsl.server;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
@ -38,10 +38,10 @@
|
||||
/**
|
||||
* Base class for HTTP server of the Ozone related components.
|
||||
*/
|
||||
public abstract class OzoneHttpServer {
|
||||
public abstract class BaseHttpServer {
|
||||
|
||||
private static final Logger LOG =
|
||||
LoggerFactory.getLogger(OzoneHttpServer.class);
|
||||
LoggerFactory.getLogger(BaseHttpServer.class);
|
||||
|
||||
private HttpServer2 httpServer;
|
||||
private final Configuration conf;
|
||||
@ -53,7 +53,7 @@ public abstract class OzoneHttpServer {
|
||||
|
||||
private String name;
|
||||
|
||||
public OzoneHttpServer(Configuration conf, String name) throws IOException {
|
||||
public BaseHttpServer(Configuration conf, String name) throws IOException {
|
||||
this.name = name;
|
||||
this.conf = conf;
|
||||
if (isEnabled()) {
|
||||
@ -85,7 +85,7 @@ public OzoneHttpServer(Configuration conf, String name) throws IOException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a servlet to OzoneHttpServer.
|
||||
* Add a servlet to BaseHttpServer.
|
||||
* @param servletName The name of the servlet
|
||||
* @param pathSpec The path spec for the servlet
|
||||
* @param clazz The servlet class
|
@ -15,7 +15,7 @@
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.ozone.web.util;
|
||||
package org.apache.hadoop.hdsl.server;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.InetSocketAddress;
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.jmx;
|
||||
package org.apache.hadoop.hdsl.server;
|
||||
|
||||
/**
|
||||
* Common runtime information for any service components.
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.jmx;
|
||||
package org.apache.hadoop.hdsl.server;
|
||||
|
||||
import org.apache.hadoop.util.VersionInfo;
|
||||
|
@ -16,8 +16,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.ozone.web;
|
||||
package org.apache.hadoop.hdsl.server;
|
||||
|
||||
/**
|
||||
* Classes related to the ozone web interface.
|
||||
* Common server side utilities for all the hdsl/ozone server components.
|
||||
*/
|
@ -1,23 +0,0 @@
|
||||
/**
|
||||
* 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.hadoop.ozone.web.util;
|
||||
|
||||
/**
|
||||
* Shared utilities for both Ozone/HDSL server side components.
|
||||
*/
|
@ -15,22 +15,23 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.ozone.web;
|
||||
package org.apache.hadoop.hdsl.server;
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
|
||||
import org.apache.hadoop.hdsl.conf.OzoneConfiguration;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Test Common ozone web methods.
|
||||
* Test Common ozone/hdsl web methods.
|
||||
*/
|
||||
public class TestOzoneHttpServer {
|
||||
public class TestBaseHttpServer {
|
||||
@Test
|
||||
public void getBindAddress() throws Exception {
|
||||
OzoneConfiguration conf = new OzoneConfiguration();
|
||||
Configuration conf = new Configuration();
|
||||
conf.set("enabled", "false");
|
||||
|
||||
OzoneHttpServer ozoneHttpServer = new OzoneHttpServer(conf, "test") {
|
||||
BaseHttpServer baseHttpServer = new BaseHttpServer(conf, "test") {
|
||||
@Override
|
||||
protected String getHttpAddressKey() {
|
||||
return null;
|
||||
@ -84,13 +85,13 @@ protected String getEnabledKey() {
|
||||
|
||||
conf.set("addresskey", "0.0.0.0:1234");
|
||||
|
||||
Assert.assertEquals("/0.0.0.0:1234", ozoneHttpServer
|
||||
Assert.assertEquals("/0.0.0.0:1234", baseHttpServer
|
||||
.getBindAddress("bindhostkey", "addresskey",
|
||||
"default", 65).toString());
|
||||
|
||||
conf.set("bindhostkey", "1.2.3.4");
|
||||
|
||||
Assert.assertEquals("/1.2.3.4:1234", ozoneHttpServer
|
||||
Assert.assertEquals("/1.2.3.4:1234", baseHttpServer
|
||||
.getBindAddress("bindhostkey", "addresskey",
|
||||
"default", 65).toString());
|
||||
}
|
@ -21,7 +21,7 @@
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.jmx.ServiceRuntimeInfo;
|
||||
import org.apache.hadoop.hdsl.server.ServiceRuntimeInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
import static org.apache.hadoop.ozone.OzoneConsts.SCM_ID;
|
||||
import static org.apache.hadoop.ozone.OzoneConsts.STORAGE_DIR;
|
||||
import static org.apache.hadoop.ozone.web.util.ServerUtils.getOzoneMetaDirPath;
|
||||
import static org.apache.hadoop.hdsl.server.ServerUtils.getOzoneMetaDirPath;
|
||||
|
||||
/**
|
||||
* SCMStorage is responsible for management of the StorageDirectories used by
|
||||
|
@ -33,7 +33,7 @@
|
||||
import org.apache.hadoop.io.IOUtils;
|
||||
import org.apache.hadoop.ipc.ProtobufRpcEngine;
|
||||
import org.apache.hadoop.ipc.RPC;
|
||||
import org.apache.hadoop.jmx.ServiceRuntimeInfoImpl;
|
||||
import org.apache.hadoop.hdsl.server.ServiceRuntimeInfoImpl;
|
||||
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
|
||||
import org.apache.hadoop.metrics2.util.MBeans;
|
||||
import org.apache.hadoop.ozone.OzoneConfigKeys;
|
||||
@ -103,7 +103,7 @@
|
||||
.getScmClientBindAddress;
|
||||
import static org.apache.hadoop.ozone.scm.HdslServerUtil
|
||||
.getScmDataNodeBindAddress;
|
||||
import static org.apache.hadoop.ozone.web.util.ServerUtils
|
||||
import static org.apache.hadoop.hdsl.server.ServerUtils
|
||||
.updateRPCListenAddress;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -18,8 +18,8 @@
|
||||
package org.apache.hadoop.ozone.scm;
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hdsl.server.BaseHttpServer;
|
||||
import org.apache.hadoop.ozone.OzoneConfigKeys;
|
||||
import org.apache.hadoop.ozone.web.OzoneHttpServer;
|
||||
import org.apache.hadoop.scm.ScmConfigKeys;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -27,7 +27,7 @@
|
||||
/**
|
||||
* HttpServer2 wrapper for the Ozone Storage Container Manager.
|
||||
*/
|
||||
public class StorageContainerManagerHttpServer extends OzoneHttpServer {
|
||||
public class StorageContainerManagerHttpServer extends BaseHttpServer {
|
||||
|
||||
public StorageContainerManagerHttpServer(Configuration conf)
|
||||
throws IOException {
|
||||
|
@ -36,7 +36,7 @@
|
||||
import org.apache.hadoop.utils.MetadataStore;
|
||||
import org.apache.hadoop.utils.MetadataStoreBuilder;
|
||||
|
||||
import static org.apache.hadoop.ozone.web.util.ServerUtils.getOzoneMetaDirPath;
|
||||
import static org.apache.hadoop.hdsl.server.ServerUtils.getOzoneMetaDirPath;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
import org.apache.hadoop.utils.MetadataStore;
|
||||
import org.apache.hadoop.utils.MetadataStoreBuilder;
|
||||
|
||||
import static org.apache.hadoop.ozone.web.util.ServerUtils.getOzoneMetaDirPath;
|
||||
import static org.apache.hadoop.hdsl.server.ServerUtils.getOzoneMetaDirPath;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
||||
import org.apache.hadoop.utils.MetadataStore;
|
||||
import org.apache.hadoop.utils.MetadataStoreBuilder;
|
||||
|
||||
import static org.apache.hadoop.ozone.web.util.ServerUtils.getOzoneMetaDirPath;
|
||||
import static org.apache.hadoop.hdsl.server.ServerUtils.getOzoneMetaDirPath;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
import org.apache.hadoop.utils.MetadataStore;
|
||||
import org.apache.hadoop.utils.MetadataStoreBuilder;
|
||||
|
||||
import static org.apache.hadoop.ozone.web.util.ServerUtils.getOzoneMetaDirPath;
|
||||
import static org.apache.hadoop.hdsl.server.ServerUtils.getOzoneMetaDirPath;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
import org.apache.hadoop.ozone.web.response.KeyInfo;
|
||||
import org.apache.hadoop.ozone.web.response.ListKeys;
|
||||
|
||||
import static org.apache.hadoop.ozone.web.util.ServerUtils.releaseConnection;
|
||||
import static org.apache.hadoop.hdsl.server.ServerUtils.releaseConnection;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.methods.HttpDelete;
|
||||
|
@ -31,7 +31,7 @@
|
||||
import org.apache.hadoop.ozone.web.utils.OzoneUtils;
|
||||
import org.apache.hadoop.util.Time;
|
||||
|
||||
import static org.apache.hadoop.ozone.web.util.ServerUtils.releaseConnection;
|
||||
import static org.apache.hadoop.hdsl.server.ServerUtils.releaseConnection;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.methods.HttpDelete;
|
||||
|
@ -31,7 +31,7 @@
|
||||
import org.apache.hadoop.ozone.OzoneConsts;
|
||||
import org.apache.hadoop.ozone.web.utils.OzoneUtils;
|
||||
|
||||
import static org.apache.hadoop.ozone.web.util.ServerUtils.releaseConnection;
|
||||
import static org.apache.hadoop.hdsl.server.ServerUtils.releaseConnection;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.methods.HttpDelete;
|
||||
|
@ -19,7 +19,7 @@
|
||||
package org.apache.hadoop.ozone.ksm;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.jmx.ServiceRuntimeInfo;
|
||||
import org.apache.hadoop.hdsl.server.ServiceRuntimeInfo;
|
||||
|
||||
/**
|
||||
* This is the JMX management interface for ksm information.
|
||||
|
@ -65,7 +65,7 @@
|
||||
.OZONE_KSM_DB_CACHE_SIZE_DEFAULT;
|
||||
import static org.apache.hadoop.ozone.ksm.KSMConfigKeys
|
||||
.OZONE_KSM_DB_CACHE_SIZE_MB;
|
||||
import static org.apache.hadoop.ozone.web.util.ServerUtils.getOzoneMetaDirPath;
|
||||
import static org.apache.hadoop.hdsl.server.ServerUtils.getOzoneMetaDirPath;
|
||||
|
||||
/**
|
||||
* KSM metadata manager interface.
|
||||
|
@ -26,7 +26,7 @@
|
||||
import org.apache.hadoop.hdsl.protocol.proto.HdslProtos.NodeType;
|
||||
|
||||
import static org.apache.hadoop.ozone.OzoneConsts.SCM_ID;
|
||||
import static org.apache.hadoop.ozone.web.util.ServerUtils.getOzoneMetaDirPath;
|
||||
import static org.apache.hadoop.hdsl.server.ServerUtils.getOzoneMetaDirPath;
|
||||
|
||||
/**
|
||||
* KSMStorage is responsible for management of the StorageDirectories used by
|
||||
|
@ -25,7 +25,7 @@
|
||||
import org.apache.hadoop.ipc.Client;
|
||||
import org.apache.hadoop.ipc.ProtobufRpcEngine;
|
||||
import org.apache.hadoop.ipc.RPC;
|
||||
import org.apache.hadoop.jmx.ServiceRuntimeInfoImpl;
|
||||
import org.apache.hadoop.hdsl.server.ServiceRuntimeInfoImpl;
|
||||
import org.apache.hadoop.ozone.common.Storage.StorageState;
|
||||
import org.apache.hadoop.ozone.ksm.exceptions.KSMException;
|
||||
import org.apache.hadoop.ozone.ksm.helpers.KsmBucketArgs;
|
||||
@ -67,7 +67,7 @@
|
||||
import static org.apache.hadoop.hdsl.HdslUtils.getScmAddressForClients;
|
||||
import static org.apache.hadoop.hdsl.HdslUtils.isHdslEnabled;
|
||||
import static org.apache.hadoop.ozone.KsmUtils.getKsmAddress;
|
||||
import static org.apache.hadoop.ozone.web.util.ServerUtils
|
||||
import static org.apache.hadoop.hdsl.server.ServerUtils
|
||||
.updateRPCListenAddress;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -20,14 +20,14 @@
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.ozone.OzoneConfigKeys;
|
||||
import org.apache.hadoop.ozone.OzoneConsts;
|
||||
import org.apache.hadoop.ozone.web.OzoneHttpServer;
|
||||
import org.apache.hadoop.hdsl.server.BaseHttpServer;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* HttpServer wrapper for the KeySpaceManager.
|
||||
*/
|
||||
public class KeySpaceManagerHttpServer extends OzoneHttpServer {
|
||||
public class KeySpaceManagerHttpServer extends BaseHttpServer {
|
||||
|
||||
public KeySpaceManagerHttpServer(Configuration conf, KeySpaceManager ksm)
|
||||
throws IOException {
|
||||
|
Loading…
Reference in New Issue
Block a user