Small changes to allow for disabling the web gui.
Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/aeb084a0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/aeb084a0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/aeb084a0 Branch: refs/heads/master Commit: aeb084a03c2880c596f5954002065e6b6166eb38 Parents: 7788230 Author: Aaron McCurry <[email protected]> Authored: Tue Aug 28 23:05:42 2012 -0400 Committer: Aaron McCurry <[email protected]> Committed: Tue Aug 28 23:05:42 2012 -0400 ---------------------------------------------------------------------- .../blur/thrift/ThriftBlurControllerServer.java | 27 +++++++------ .../blur/thrift/ThriftBlurShardServer.java | 31 ++++++++------- .../java/com/nearinfinity/blur/MiniCluster.java | 2 + src/blur-gui/pom.xml | 1 - 4 files changed, 34 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/aeb084a0/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurControllerServer.java ---------------------------------------------------------------------- diff --git a/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurControllerServer.java b/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurControllerServer.java index f42329a..8b9b0be 100644 --- a/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurControllerServer.java +++ b/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurControllerServer.java @@ -91,7 +91,7 @@ public class ThriftBlurControllerServer extends ThriftServer { final ZooKeeper zooKeeper = ZkUtils.newZooKeeper(zkConnectionStr); ZookeeperSystemTime.checkSystemTime(zooKeeper, configuration.getLong(BLUR_ZOOKEEPER_SYSTEM_TIME_TOLERANCE, 3000)); - + BlurUtil.setupZookeeper(zooKeeper); final ZookeeperClusterStatus clusterStatus = new ZookeeperClusterStatus(zooKeeper); @@ -131,17 +131,20 @@ public class ThriftBlurControllerServer extends ThriftServer { server.setBindPort(bindPort); server.setThreadCount(threadCount); server.setIface(iface); - - int webServerPort = Integer.parseInt(configuration.get(BLUR_GUI_CONTROLLER_PORT)) + serverIndex; - - //TODO: this got ugly, there has to be a better way to handle all these params - //without reversing the mvn dependancy and making blur-gui on top. - final HttpJettyServer httpServer = new HttpJettyServer(bindPort, webServerPort, - configuration.getInt(BLUR_CONTROLLER_BIND_PORT, -1), - configuration.getInt(BLUR_SHARD_BIND_PORT, -1), - configuration.getInt(BLUR_GUI_CONTROLLER_PORT,-1), - configuration.getInt(BLUR_GUI_SHARD_PORT,-1), - "controller", blurMetrics); + + int baseGuiPort = Integer.parseInt(configuration.get(BLUR_GUI_CONTROLLER_PORT)); + final HttpJettyServer httpServer; + if (baseGuiPort > 0) { + int webServerPort = baseGuiPort + serverIndex; + + // TODO: this got ugly, there has to be a better way to handle all these + // params + // without reversing the mvn dependancy and making blur-gui on top. + httpServer = new HttpJettyServer(bindPort, webServerPort, configuration.getInt(BLUR_CONTROLLER_BIND_PORT, -1), configuration.getInt(BLUR_SHARD_BIND_PORT, -1), + configuration.getInt(BLUR_GUI_CONTROLLER_PORT, -1), configuration.getInt(BLUR_GUI_SHARD_PORT, -1), "controller", blurMetrics); + } else { + httpServer = null; + } // This will shutdown the server when the correct path is set in zk BlurShutdown shutdown = new BlurShutdown() { http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/aeb084a0/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurShardServer.java ---------------------------------------------------------------------- diff --git a/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurShardServer.java b/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurShardServer.java index ab2a489..3fcfac2 100644 --- a/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurShardServer.java +++ b/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurShardServer.java @@ -16,10 +16,10 @@ package com.nearinfinity.blur.thrift; +import static com.nearinfinity.blur.utils.BlurConstants.BLUR_CLUSTER_NAME; import static com.nearinfinity.blur.utils.BlurConstants.BLUR_CONTROLLER_BIND_PORT; import static com.nearinfinity.blur.utils.BlurConstants.BLUR_GUI_CONTROLLER_PORT; import static com.nearinfinity.blur.utils.BlurConstants.BLUR_GUI_SHARD_PORT; -import static com.nearinfinity.blur.utils.BlurConstants.BLUR_CLUSTER_NAME; import static com.nearinfinity.blur.utils.BlurConstants.BLUR_INDEXMANAGER_SEARCH_THREAD_COUNT; import static com.nearinfinity.blur.utils.BlurConstants.BLUR_MAX_CLAUSE_COUNT; import static com.nearinfinity.blur.utils.BlurConstants.BLUR_SHARD_BIND_ADDRESS; @@ -149,8 +149,8 @@ public class ThriftBlurShardServer extends ThriftServer { System.exit(1); } } - - BlurUtil.setupZookeeper(zooKeeper,configuration.get(BLUR_CLUSTER_NAME)); + + BlurUtil.setupZookeeper(zooKeeper, configuration.get(BLUR_CLUSTER_NAME)); final ZookeeperClusterStatus clusterStatus = new ZookeeperClusterStatus(zooKeeper); @@ -208,17 +208,20 @@ public class ThriftBlurShardServer extends ThriftServer { server.setThreadCount(threadCount); server.setIface(iface); server.setConfiguration(configuration); - - int webServerPort = Integer.parseInt(configuration.get(BLUR_GUI_SHARD_PORT)) + serverIndex; - - //TODO: this got ugly, there has to be a better way to handle all these params - //without reversing the mvn dependancy and making blur-gui on top. - final HttpJettyServer httpServer = new HttpJettyServer(bindPort, webServerPort, - configuration.getInt(BLUR_CONTROLLER_BIND_PORT, -1), - configuration.getInt(BLUR_SHARD_BIND_PORT, -1), - configuration.getInt(BLUR_GUI_CONTROLLER_PORT,-1), - configuration.getInt(BLUR_GUI_SHARD_PORT,-1), - "shard", blurMetrics); + + int baseGuiPort = Integer.parseInt(configuration.get(BLUR_GUI_SHARD_PORT)); + final HttpJettyServer httpServer; + if (baseGuiPort > 0) { + int webServerPort = baseGuiPort + serverIndex; + + // TODO: this got ugly, there has to be a better way to handle all these + // params + // without reversing the mvn dependancy and making blur-gui on top. + httpServer = new HttpJettyServer(bindPort, webServerPort, configuration.getInt(BLUR_CONTROLLER_BIND_PORT, -1), configuration.getInt(BLUR_SHARD_BIND_PORT, -1), + configuration.getInt(BLUR_GUI_CONTROLLER_PORT, -1), configuration.getInt(BLUR_GUI_SHARD_PORT, -1), "shard", blurMetrics); + } else { + httpServer = null; + } // This will shutdown the server when the correct path is set in zk BlurShutdown shutdown = new BlurShutdown() { http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/aeb084a0/src/blur-core/src/test/java/com/nearinfinity/blur/MiniCluster.java ---------------------------------------------------------------------- diff --git a/src/blur-core/src/test/java/com/nearinfinity/blur/MiniCluster.java b/src/blur-core/src/test/java/com/nearinfinity/blur/MiniCluster.java index a15c6b1..5c8e1da 100644 --- a/src/blur-core/src/test/java/com/nearinfinity/blur/MiniCluster.java +++ b/src/blur-core/src/test/java/com/nearinfinity/blur/MiniCluster.java @@ -175,6 +175,8 @@ public abstract class MiniCluster { configuration.set(BLUR_SHARD_BLOCKCACHE_DIRECT_MEMORY_ALLOCATION, "false"); configuration.set(BLUR_SHARD_BLOCKCACHE_SLAB_COUNT, "0"); configuration.setLong(BLUR_SHARD_SAFEMODEDELAY, 5000); + configuration.setInt(BLUR_GUI_CONTROLLER_PORT, -1); + configuration.setInt(BLUR_GUI_SHARD_PORT, -1); return configuration; } http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/aeb084a0/src/blur-gui/pom.xml ---------------------------------------------------------------------- diff --git a/src/blur-gui/pom.xml b/src/blur-gui/pom.xml index 1fca209..666c529 100644 --- a/src/blur-gui/pom.xml +++ b/src/blur-gui/pom.xml @@ -111,7 +111,6 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> - <version>2.0.2</version> <configuration> <source>1.6</source> <target>1.6</target>
