incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From twilli...@apache.org
Subject [1/2] git commit: allow gui to run on random port too BLUR-342
Date Thu, 17 Jul 2014 14:17:48 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/blur-342 effe82b60 -> 3972f6665


allow gui to run on random port too BLUR-342


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/8e7fdb66
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/8e7fdb66
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/8e7fdb66

Branch: refs/heads/blur-342
Commit: 8e7fdb66fcfcd553b57607059ab5f6f76ec3f697
Parents: effe82b
Author: Tim <twilliams@apache.org>
Authored: Thu Jul 17 10:08:30 2014 -0400
Committer: Tim <twilliams@apache.org>
Committed: Thu Jul 17 10:08:30 2014 -0400

----------------------------------------------------------------------
 .../blur/thrift/ThriftBlurControllerServer.java | 13 +++++++---
 .../blur/thrift/ThriftBlurShardServer.java      | 26 ++++++++++++--------
 .../src/main/resources/blur-default.properties  |  4 +--
 3 files changed, 27 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/8e7fdb66/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
index 1297447..396b883 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
@@ -173,11 +173,16 @@ public class ThriftBlurControllerServer extends ThriftServer {
     server.setSelectorThreads(configuration.getInt(BLUR_CONTROLLER_THRIFT_SELECTOR_THREADS,
2));
     server.setMaxFrameSize(configuration.getInt(BLUR_THRIFT_MAX_FRAME_SIZE, 16384000));
 
-    int baseGuiPort = Integer.parseInt(configuration.get(BLUR_GUI_CONTROLLER_PORT));
+    int configGuiPort = Integer.parseInt(configuration.get(BLUR_GUI_CONTROLLER_PORT));
+    int instanceGuiPort = configGuiPort + serverIndex;
+    
+    if(configGuiPort == 0) {
+  	  instanceGuiPort = 0;
+    }
+    
     final HttpJettyServer httpServer;
-    if (baseGuiPort >= 0) {
-      int webServerPort = baseGuiPort + serverIndex;
-      httpServer = new HttpJettyServer(HttpJettyServer.class, webServerPort);
+    if (configGuiPort >= 0) {
+      httpServer = new HttpJettyServer(HttpJettyServer.class, instanceGuiPort);
       int port = httpServer.getLocalPort();
       configuration.setInt(BLUR_HTTP_STATUS_RUNNING_PORT, port);
     } else {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/8e7fdb66/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
index 52bd2ff..f740482 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
@@ -146,16 +146,6 @@ public class ThriftBlurShardServer extends ThriftServer {
       instanceBindPort = tNonblockingServerSocket.getServerSocket().getLocalPort();
     }
 
-    int baseGuiPort = Integer.parseInt(configuration.get(BLUR_GUI_SHARD_PORT));
-    final HttpJettyServer httpServer;
-    if (baseGuiPort > 0) {
-      int webServerPort = baseGuiPort + serverIndex;
-      httpServer = new HttpJettyServer(HttpJettyServer.class, webServerPort);
-      int port = httpServer.getLocalPort();
-      configuration.setInt(BLUR_HTTP_STATUS_RUNNING_PORT, port);
-    } else {
-      httpServer = null;
-    }
 
     Set<Entry<String, String>> set = configuration.getProperties().entrySet();
     for (Entry<String, String> e : set) {
@@ -258,6 +248,22 @@ public class ThriftBlurShardServer extends ThriftServer {
     iface = BlurUtil.runWithUser(iface, false);
     iface = BlurUtil.runTrace(iface, false);
     iface = BlurUtil.lastChanceErrorHandling(iface, Iface.class);
+
+    int configGuiPort = Integer.parseInt(configuration.get(BLUR_GUI_SHARD_PORT));
+    int instanceGuiPort = configGuiPort + serverIndex;
+    
+    if(configGuiPort == 0) {
+      instanceGuiPort = 0;
+    }
+    
+    final HttpJettyServer httpServer;
+    if (configGuiPort >= 0) {
+      httpServer = new HttpJettyServer(HttpJettyServer.class, instanceGuiPort);
+      int port = httpServer.getLocalPort();
+      configuration.setInt(BLUR_HTTP_STATUS_RUNNING_PORT, port);
+    } else {
+      httpServer = null;
+    }
     if (httpServer != null) {
       WebAppContext context = httpServer.getContext();
       context.addServlet(new ServletHolder(new TServlet(new Blur.Processor<Blur.Iface>(iface),

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/8e7fdb66/blur-util/src/main/resources/blur-default.properties
----------------------------------------------------------------------
diff --git a/blur-util/src/main/resources/blur-default.properties b/blur-util/src/main/resources/blur-default.properties
index 0674f74..730239f 100644
--- a/blur-util/src/main/resources/blur-default.properties
+++ b/blur-util/src/main/resources/blur-default.properties
@@ -175,7 +175,7 @@ blur.max.heap.per.row.fetch=10000000
 # The maximum number of records in a single row fetch
 blur.max.records.per.row.fetch.request=1000
 
-# The http status page port for the shard server
+# The http status page port for the shard server, 0 for random
 blur.gui.shard.port=40090
 
 # To intercept the calls made to the shard server and perform server side changes to the
calls extend org.apache.blur.server.FilteredBlurServer.
@@ -265,7 +265,7 @@ blur.controller.retry.max.mutate.delay=2000
 # The ending backoff delay for the last retry for a all other request errors
 blur.controller.retry.max.default.delay=2000
 
-# The http status page port for the controller server
+# The http status page port for the controller server, 0 for random
 blur.gui.controller.port=40080
 
 # To intercept the calls made to the controller server and perform server side changes to
the calls extend org.apache.blur.server.FilteredBlurServer.


Mime
View raw message