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 static final String FILTER_INITIALIZER_PROPERTY
= "hadoop.http.filter.initializers"; = "hadoop.http.filter.initializers";
@Deprecated
public static final String HTTP_MAX_THREADS = HTTP_MAX_THREADS_KEY;
// The ServletContext attribute where the daemon Configuration // The ServletContext attribute where the daemon Configuration
// gets stored. // gets stored.
@ -507,7 +505,7 @@ private void initializeWebServer(String name, String hostName,
Preconditions.checkNotNull(webAppContext); 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 // If HTTP_MAX_THREADS is not configured, QueueThreadPool() will use the
// default value (currently 250). // default value (currently 250).

View File

@ -136,7 +136,7 @@ public void init(SSLFactory.Mode mode)
boolean requireClientCert = boolean requireClientCert =
conf.getBoolean(SSLFactory.SSL_REQUIRE_CLIENT_CERT_KEY, conf.getBoolean(SSLFactory.SSL_REQUIRE_CLIENT_CERT_KEY,
SSLFactory.DEFAULT_SSL_REQUIRE_CLIENT_CERT); SSLFactory.SSL_REQUIRE_CLIENT_CERT_DEFAULT);
// certificate store // certificate store
String keystoreType = String keystoreType =

View File

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

View File

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

View File

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

View File

@ -96,7 +96,7 @@ public DatanodeHttpServer(final Configuration conf,
this.conf = conf; this.conf = conf;
Configuration confForInfoServer = new Configuration(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() HttpServer2.Builder builder = new HttpServer2.Builder()
.setName("datanode") .setName("datanode")
.setConf(confForInfoServer) .setConf(confForInfoServer)