hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From whe...@apache.org
Subject hadoop git commit: HADOOP-12474. MiniKMS should use random ports for Jetty server by default. Contributed by Mingliang Liu.
Date Tue, 13 Oct 2015 20:09:30 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 535c903bc -> 950e8a459


HADOOP-12474. MiniKMS should use random ports for Jetty server by default. Contributed by
Mingliang Liu.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/950e8a45
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/950e8a45
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/950e8a45

Branch: refs/heads/branch-2
Commit: 950e8a459ea8ec3785f07ba67540eb6dac217ffd
Parents: 535c903
Author: Haohui Mai <wheat9@apache.org>
Authored: Tue Oct 13 13:07:57 2015 -0700
Committer: Haohui Mai <wheat9@apache.org>
Committed: Tue Oct 13 13:08:03 2015 -0700

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt         |  3 +++
 .../apache/hadoop/crypto/key/kms/server/MiniKMS.java    | 12 +++---------
 2 files changed, 6 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/950e8a45/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index c1649a7..5f28a27 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -701,6 +701,9 @@ Release 2.8.0 - UNRELEASED
     HADOOP-12441. Fixed shell-kill command behaviour to work correctly on some
     Linux distributions after HADOOP-12317. (Wangda Tan via vinodkv)
 
+    HADOOP-12474. MiniKMS should use random ports for Jetty server by default.
+    (Mingliang Liu via wheat9)
+
 Release 2.7.2 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/950e8a45/hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/MiniKMS.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/MiniKMS.java
b/hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/MiniKMS.java
index 4f802cc..eb640bb 100644
--- a/hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/MiniKMS.java
+++ b/hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/MiniKMS.java
@@ -47,19 +47,13 @@ public class MiniKMS {
   private static Server createJettyServer(String keyStore, String password, int inPort) {
     try {
       boolean ssl = keyStore != null;
-      InetAddress localhost = InetAddress.getByName("localhost");
       String host = "localhost";
-      ServerSocket ss = new ServerSocket((inPort < 0) ? 0 : inPort, 50, localhost);
-      int port = ss.getLocalPort();
-      ss.close();
-      Server server = new Server(0);
+      Server server = new Server(inPort);
       if (!ssl) {
         server.getConnectors()[0].setHost(host);
-        server.getConnectors()[0].setPort(port);
       } else {
         SslSocketConnector c = new SslSocketConnectorSecure();
         c.setHost(host);
-        c.setPort(port);
         c.setNeedClientAuth(false);
         c.setKeystore(keyStore);
         c.setKeystoreType("jks");
@@ -80,7 +74,7 @@ public class MiniKMS {
       String scheme = (ssl) ? "https" : "http";
       return new URL(scheme + "://" +
           server.getConnectors()[0].getHost() + ":" +
-          server.getConnectors()[0].getPort());
+          server.getConnectors()[0].getLocalPort());
     } catch (MalformedURLException ex) {
       throw new RuntimeException("It should never happen, " + ex.getMessage(),
           ex);
@@ -92,7 +86,7 @@ public class MiniKMS {
     private String log4jConfFile;
     private File keyStoreFile;
     private String keyStorePassword;
-    private int inPort = -1;
+    private int inPort;
 
     public Builder() {
       kmsConfDir = new File("target/test-classes").getAbsoluteFile();


Mime
View raw message