incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [1/7] git commit: Fixing some issues with discovering the local tmp directory.
Date Tue, 28 Oct 2014 01:59:28 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/master 838fb26bc -> dcdd25d79


Fixing some issues with discovering the local tmp directory.


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

Branch: refs/heads/master
Commit: 01242ad7016d81b2c14fc4fc56d607ed31c55591
Parents: 52645de
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Sun Oct 26 12:30:29 2014 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Sun Oct 26 12:30:29 2014 -0400

----------------------------------------------------------------------
 .../org/apache/blur/command/BaseCommandManager.java     |  4 ++--
 .../apache/blur/command/ControllerCommandManager.java   |  7 ++++---
 .../org/apache/blur/command/ShardCommandManager.java    |  3 ++-
 .../apache/blur/thrift/ThriftBlurControllerServer.java  | 12 +++++++++++-
 .../org/apache/blur/thrift/ThriftBlurShardServer.java   | 10 +++++++++-
 .../main/java/org/apache/blur/thrift/ThriftServer.java  |  4 ++--
 .../apache/blur/command/ShardCommandManagerTest.java    |  4 ++--
 7 files changed, 32 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/01242ad7/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java b/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
index ab8c46c..958c004 100644
--- a/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
+++ b/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
@@ -74,7 +74,7 @@ public abstract class BaseCommandManager implements Closeable {
   protected final Map<Class<? extends Command<?>>, String> _commandNameLookup
= new ConcurrentHashMap<Class<? extends Command<?>>, String>();
   protected final ConcurrentMap<ExecutionId, ResponseFuture> _runningMap = new MapMaker().makeMap();
   protected final long _connectionTimeout;
-  protected final String _tmpPath;
+  protected final File _tmpPath;
   protected final String _commandPath;
   protected final Timer _timer;
   protected final long _pollingPeriod = TimeUnit.SECONDS.toMillis(15);
@@ -83,7 +83,7 @@ public abstract class BaseCommandManager implements Closeable {
   protected final BlurObjectSerDe _serDe = new BlurObjectSerDe();
   protected final long _runningCacheTombstoneTime = TimeUnit.SECONDS.toMillis(60);
 
-  public BaseCommandManager(String tmpPath, String commandPath, int workerThreadCount, int
driverThreadCount,
+  public BaseCommandManager(File tmpPath, String commandPath, int workerThreadCount, int
driverThreadCount,
       long connectionTimeout, Configuration configuration) throws IOException {
     _configuration = configuration;
     lookForCommandsToRegisterInClassPath();

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/01242ad7/blur-core/src/main/java/org/apache/blur/command/ControllerCommandManager.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/ControllerCommandManager.java
b/blur-core/src/main/java/org/apache/blur/command/ControllerCommandManager.java
index 815e0ef..31901f8 100644
--- a/blur-core/src/main/java/org/apache/blur/command/ControllerCommandManager.java
+++ b/blur-core/src/main/java/org/apache/blur/command/ControllerCommandManager.java
@@ -1,5 +1,6 @@
 package org.apache.blur.command;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.Map;
 import java.util.concurrent.Callable;
@@ -7,10 +8,10 @@ import java.util.concurrent.Callable;
 import org.apache.blur.BlurConfiguration;
 import org.apache.blur.command.commandtype.ClusterExecuteCommand;
 import org.apache.blur.command.commandtype.ClusterExecuteServerReadCommand;
-import org.apache.blur.command.commandtype.ClusterServerReadCommand;
 import org.apache.blur.command.commandtype.ClusterIndexReadCommand;
-import org.apache.blur.command.commandtype.ServerReadCommand;
+import org.apache.blur.command.commandtype.ClusterServerReadCommand;
 import org.apache.blur.command.commandtype.IndexReadCommand;
+import org.apache.blur.command.commandtype.ServerReadCommand;
 import org.apache.blur.server.LayoutFactory;
 import org.apache.blur.server.TableContext;
 import org.apache.blur.server.TableContextFactory;
@@ -35,7 +36,7 @@ import org.apache.hadoop.conf.Configuration;
 @SuppressWarnings("unchecked")
 public class ControllerCommandManager extends BaseCommandManager {
 
-  public ControllerCommandManager(String tmpPath, String commandPath, int workerThreadCount,
int driverThreadCount,
+  public ControllerCommandManager(File tmpPath, String commandPath, int workerThreadCount,
int driverThreadCount,
       long connectionTimeout, Configuration configuration) throws IOException {
     super(tmpPath, commandPath, workerThreadCount, driverThreadCount, connectionTimeout,
configuration);
   }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/01242ad7/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java b/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java
index a7b10bd..ec3b6ab 100644
--- a/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java
+++ b/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java
@@ -16,6 +16,7 @@
  */
 package org.apache.blur.command;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
@@ -41,7 +42,7 @@ public class ShardCommandManager extends BaseCommandManager {
 
   private final IndexServer _indexServer;
 
-  public ShardCommandManager(IndexServer indexServer, String tmpPath, String commandPath,
int workerThreadCount,
+  public ShardCommandManager(IndexServer indexServer, File tmpPath, String commandPath, int
workerThreadCount,
       int driverThreadCount, long connectionTimeout, Configuration configuration) throws
IOException {
     super(tmpPath, commandPath, workerThreadCount, driverThreadCount, connectionTimeout,
configuration);
     _indexServer = indexServer;

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/01242ad7/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 be391c3..8320847 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
@@ -49,6 +49,8 @@ import static org.apache.blur.utils.BlurConstants.BLUR_ZOOKEEPER_TIMEOUT;
 import static org.apache.blur.utils.BlurConstants.BLUR_ZOOKEEPER_TIMEOUT_DEFAULT;
 import static org.apache.blur.utils.BlurUtil.quietClose;
 
+import java.io.File;
+
 import org.apache.blur.BlurConfiguration;
 import org.apache.blur.command.ControllerCommandManager;
 import org.apache.blur.concurrent.SimpleUncaughtExceptionHandler;
@@ -133,7 +135,15 @@ public class ThriftBlurControllerServer extends ThriftServer {
     int timeout = configuration.getInt(BLUR_CONTROLLER_SHARD_CONNECTION_TIMEOUT, 60000);
     BlurControllerServer.BlurClient client = new BlurControllerServer.BlurClientRemote(timeout);
 
-    String tmpPath = configuration.get(BLUR_TMP_PATH, getDefaultTmpPath(BLUR_TMP_PATH));
+    File defaultTmpPath = getDefaultTmpPath(BLUR_TMP_PATH);
+    String configTmpPath = configuration.get(BLUR_TMP_PATH);
+    File tmpPath;
+    if (!(configTmpPath == null || configTmpPath.isEmpty())) {
+      tmpPath = new File(configTmpPath);
+    } else {
+      tmpPath = defaultTmpPath;
+    }
+
     int numberOfControllerWorkerCommandThreads = configuration.getInt(BLUR_CONTROLLER_COMMAND_WORKER_THREADS,
16);
     int numberOfControllerDriverCommandThreads = configuration.getInt(BLUR_CONTROLLER_COMMAND_DRIVER_THREADS,
16);
     String commandPath = configuration.get(BLUR_COMMAND_LIB_PATH, getCommandLibPath());

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/01242ad7/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 56dd688..eba2cb3 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
@@ -55,6 +55,7 @@ import static org.apache.blur.utils.BlurConstants.BLUR_ZOOKEEPER_TIMEOUT;
 import static org.apache.blur.utils.BlurConstants.BLUR_ZOOKEEPER_TIMEOUT_DEFAULT;
 import static org.apache.blur.utils.BlurUtil.quietClose;
 
+import java.io.File;
 import java.lang.reflect.Constructor;
 import java.util.Map.Entry;
 import java.util.Set;
@@ -227,7 +228,14 @@ public class ThriftBlurShardServer extends ThriftServer {
         fetchCount, indexManagerThreadCount, mutateThreadCount, statusCleanupTimerDelay,
facetThreadCount,
         deepPagingCache);
 
-    String tmpPath = configuration.get(BLUR_TMP_PATH, getDefaultTmpPath(BLUR_TMP_PATH));
+    File defaultTmpPath = getDefaultTmpPath(BLUR_TMP_PATH);
+    String configTmpPath = configuration.get(BLUR_TMP_PATH);
+    File tmpPath;
+    if (!(configTmpPath == null || configTmpPath.isEmpty())) {
+      tmpPath = new File(configTmpPath);
+    } else {
+      tmpPath = defaultTmpPath;
+    }
     int numberOfShardWorkerCommandThreads = configuration.getInt(BLUR_SHARD_COMMAND_WORKER_THREADS,
16);
     int numberOfShardDriverCommandThreads = configuration.getInt(BLUR_SHARD_COMMAND_DRIVER_THREADS,
16);
     String commandPath = configuration.get(BLUR_COMMAND_LIB_PATH, getCommandLibPath());

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/01242ad7/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java b/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
index c961959..57661e3 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
@@ -114,7 +114,7 @@ public class ThriftServer {
     return System.getenv(BLUR_HOME);
   }
 
-  public static String getDefaultTmpPath(String propName) throws IOException {
+  public static File getDefaultTmpPath(String propName) throws IOException {
     String blurHomeDir = getBlurHomeDir();
     File tmp;
     if (blurHomeDir == null) {
@@ -137,7 +137,7 @@ public class ThriftServer {
       throw new IOException("Cannot create tmp file in [" + tmp.toURI() + "].");
     }
     file.delete();
-    return tmp.toURI().toString();
+    return tmp;
   }
 
   private static File getTmpDir() {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/01242ad7/blur-core/src/test/java/org/apache/blur/command/ShardCommandManagerTest.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/java/org/apache/blur/command/ShardCommandManagerTest.java
b/blur-core/src/test/java/org/apache/blur/command/ShardCommandManagerTest.java
index 5b67c6d..5fec597 100644
--- a/blur-core/src/test/java/org/apache/blur/command/ShardCommandManagerTest.java
+++ b/blur-core/src/test/java/org/apache/blur/command/ShardCommandManagerTest.java
@@ -71,7 +71,7 @@ public class ShardCommandManagerTest {
       throw new RuntimeException(e);
     }
   }
-  private String _tmpPath = "./target/tmp/ShardCommandManagerTest/tmp";
+  private File _tmpPath = new File("./target/tmp/ShardCommandManagerTest/tmp");
   private String _commandPath = "./target/tmp/ShardCommandManagerTest/command";
   private ShardCommandManager _manager;
   private Configuration _config;
@@ -114,7 +114,7 @@ public class ShardCommandManagerTest {
   @Test
   public void testNewCommandLoading() throws IOException, TimeoutException, InterruptedException,
ExceptionCollector {
     _manager.close();
-    new File(_tmpPath).mkdirs();
+    _tmpPath.mkdirs();
     File commandPath = new File(_commandPath);
     rmr(commandPath);
     if (commandPath.exists()) {


Mime
View raw message