HADOOP-13955. Replace deprecated HttpServer2 and SSLFactory constants. Contributed by John Zhuge.

This commit is contained in:
Akira Ajisaka 2017-01-18 18:11:33 +09:00
parent b1a9ec856b
commit 9130af3f74
6 changed files with 8 additions and 21 deletions

View File

@ -131,8 +131,6 @@ public final class HttpServer2 implements FilterContainer {
static final String FILTER_INITIALIZER_PROPERTY
= "hadoop.http.filter.initializers";
@Deprecated
public static final String HTTP_MAX_THREADS = HTTP_MAX_THREADS_KEY;
// The ServletContext attribute where the daemon Configuration
// gets stored.
@ -507,7 +505,7 @@ public final class HttpServer2 implements FilterContainer {
Preconditions.checkNotNull(webAppContext);
int maxThreads = conf.getInt(HTTP_MAX_THREADS, -1);
int maxThreads = conf.getInt(HTTP_MAX_THREADS_KEY, -1);
// If HTTP_MAX_THREADS is not configured, QueueThreadPool() will use the
// default value (currently 250).

View File

@ -136,7 +136,7 @@ public class FileBasedKeyStoresFactory implements KeyStoresFactory {
boolean requireClientCert =
conf.getBoolean(SSLFactory.SSL_REQUIRE_CLIENT_CERT_KEY,
SSLFactory.DEFAULT_SSL_REQUIRE_CLIENT_CERT);
SSLFactory.SSL_REQUIRE_CLIENT_CERT_DEFAULT);
// certificate store
String keystoreType =

View File

@ -100,22 +100,11 @@ public class SSLFactory implements ConnectionConfigurator {
public static final String SSL_SERVER_EXCLUDE_CIPHER_LIST =
"ssl.server.exclude.cipher.list";
@Deprecated
public static final boolean DEFAULT_SSL_REQUIRE_CLIENT_CERT =
SSL_REQUIRE_CLIENT_CERT_DEFAULT;
public static final String SSLCERTIFICATE = IBM_JAVA?"ibmX509":"SunX509";
public static final String KEYSTORES_FACTORY_CLASS_KEY =
"hadoop.ssl.keystores.factory.class";
@Deprecated
public static final String SSL_ENABLED_PROTOCOLS =
SSL_ENABLED_PROTOCOLS_KEY;
@Deprecated
public static final String DEFAULT_SSL_ENABLED_PROTOCOLS =
SSL_ENABLED_PROTOCOLS_DEFAULT;
private Configuration conf;
private Mode mode;
private boolean requireClientCert;
@ -140,7 +129,7 @@ public class SSLFactory implements ConnectionConfigurator {
}
this.mode = mode;
requireClientCert = conf.getBoolean(SSL_REQUIRE_CLIENT_CERT_KEY,
DEFAULT_SSL_REQUIRE_CLIENT_CERT);
SSL_REQUIRE_CLIENT_CERT_DEFAULT);
Configuration sslConf = readSSLConfiguration(mode);
Class<? extends KeyStoresFactory> klass
@ -148,8 +137,8 @@ public class SSLFactory implements ConnectionConfigurator {
FileBasedKeyStoresFactory.class, KeyStoresFactory.class);
keystoresFactory = ReflectionUtils.newInstance(klass, sslConf);
enabledProtocols = conf.getStrings(SSL_ENABLED_PROTOCOLS,
DEFAULT_SSL_ENABLED_PROTOCOLS);
enabledProtocols = conf.getStrings(SSL_ENABLED_PROTOCOLS_KEY,
SSL_ENABLED_PROTOCOLS_DEFAULT);
String excludeCiphersConf =
sslConf.get(SSL_SERVER_EXCLUDE_CIPHER_LIST, "");
if (excludeCiphersConf.isEmpty()) {

View File

@ -145,7 +145,7 @@ public class TestHttpServer extends HttpServerFunctionalTest {
@BeforeClass public static void setup() throws Exception {
Configuration conf = new Configuration();
conf.setInt(HttpServer2.HTTP_MAX_THREADS, 10);
conf.setInt(HttpServer2.HTTP_MAX_THREADS_KEY, 10);
server = createTestServer(conf);
server.addServlet("echo", "/echo", EchoServlet.class);
server.addServlet("echomap", "/echomap", EchoMapServlet.class);

View File

@ -82,7 +82,7 @@ public class TestSSLHttpServer extends HttpServerFunctionalTest {
@BeforeClass
public static void setup() throws Exception {
conf = new Configuration();
conf.setInt(HttpServer2.HTTP_MAX_THREADS, 10);
conf.setInt(HttpServer2.HTTP_MAX_THREADS_KEY, 10);
File base = new File(BASEDIR);
FileUtil.fullyDelete(base);

View File

@ -96,7 +96,7 @@ public class DatanodeHttpServer implements Closeable {
this.conf = conf;
Configuration confForInfoServer = new Configuration(conf);
confForInfoServer.setInt(HttpServer2.HTTP_MAX_THREADS, 10);
confForInfoServer.setInt(HttpServer2.HTTP_MAX_THREADS_KEY, 10);
HttpServer2.Builder builder = new HttpServer2.Builder()
.setName("datanode")
.setConf(confForInfoServer)