incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [4/4] git commit: Setting up hdfs trace storage to not create a new hadoop config object.
Date Sat, 28 Mar 2015 15:14:26 GMT
Setting up hdfs trace storage to not create a new hadoop config object.


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

Branch: refs/heads/master
Commit: f320ffaffe1997d4652d3bae13389770dd97cdf7
Parents: 99aa240
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Sat Mar 28 11:14:33 2015 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Sat Mar 28 11:14:33 2015 -0400

----------------------------------------------------------------------
 .../blur/thrift/ThriftBlurControllerServer.java     |  2 +-
 .../apache/blur/thrift/ThriftBlurShardServer.java   |  2 +-
 .../java/org/apache/blur/thrift/ThriftServer.java   |  7 +++++--
 .../apache/blur/trace/hdfs/HdfsTraceStorage.java    | 16 +++++++++-------
 4 files changed, 16 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f320ffaf/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 a3e2c90..4c943b9 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
@@ -188,7 +188,7 @@ public class ThriftBlurControllerServer extends ThriftServer {
 
     controllerServer.init();
 
-    final TraceStorage traceStorage = setupTraceStorage(configuration);
+    final TraceStorage traceStorage = setupTraceStorage(configuration, config);
     Trace.setStorage(traceStorage);
     Trace.setNodeName(nodeName);
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f320ffaf/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 8a6fd55..f624119 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
@@ -288,7 +288,7 @@ public class ThriftBlurShardServer extends ThriftServer {
     shardServer.setConfiguration(configuration);
     shardServer.init();
 
-    final TraceStorage traceStorage = setupTraceStorage(configuration);
+    final TraceStorage traceStorage = setupTraceStorage(configuration, config);
     Trace.setStorage(traceStorage);
     Trace.setNodeName(nodeName);
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f320ffaf/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 6e79afa..7070424 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
@@ -76,6 +76,7 @@ import org.apache.blur.thrift.server.TThreadedSelectorServer.Args.AcceptPolicy;
 import org.apache.blur.trace.LogTraceStorage;
 import org.apache.blur.trace.TraceStorage;
 import org.apache.blur.trace.hdfs.HdfsTraceStorage;
+import org.apache.hadoop.conf.Configuration;
 
 import com.yammer.metrics.Metrics;
 import com.yammer.metrics.core.Gauge;
@@ -177,10 +178,12 @@ public class ThriftServer {
     return new File(System.getProperty("java.io.tmpdir"), "blur_tmp");
   }
 
-  public static TraceStorage setupTraceStorage(BlurConfiguration configuration) throws IOException
{
+  public static TraceStorage setupTraceStorage(BlurConfiguration configuration, Configuration
conf) throws IOException {
     String hdfsPath = configuration.get(BLUR_HDFS_TRACE_PATH);
     if (hdfsPath != null) {
-      return new HdfsTraceStorage(configuration);
+      HdfsTraceStorage hdfsTraceStorage = new HdfsTraceStorage(configuration);
+      hdfsTraceStorage.init(conf);
+      return hdfsTraceStorage;
     } else {
       return new LogTraceStorage(configuration);
     }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f320ffaf/blur-core/src/main/java/org/apache/blur/trace/hdfs/HdfsTraceStorage.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/trace/hdfs/HdfsTraceStorage.java b/blur-core/src/main/java/org/apache/blur/trace/hdfs/HdfsTraceStorage.java
index ad069e0..b6b1a31 100644
--- a/blur-core/src/main/java/org/apache/blur/trace/hdfs/HdfsTraceStorage.java
+++ b/blur-core/src/main/java/org/apache/blur/trace/hdfs/HdfsTraceStorage.java
@@ -46,16 +46,18 @@ public class HdfsTraceStorage extends TraceStorage {
 
   private final static Log LOG = LogFactory.getLog(HdfsTraceStorage.class);
 
-  private final Path _storePath;
-  private final BlockingQueue<TraceCollector> _queue = new LinkedBlockingQueue<TraceCollector>();
-  private final Thread _daemon;
-  private final Configuration _conf = new Configuration();
-  private final FileSystem _fileSystem;
+  private Path _storePath;
+  private BlockingQueue<TraceCollector> _queue = new LinkedBlockingQueue<TraceCollector>();
+  private Thread _daemon;
+  private FileSystem _fileSystem;
 
   public HdfsTraceStorage(BlurConfiguration configuration) throws IOException {
     super(configuration);
-    _storePath = new Path(configuration.get(BLUR_HDFS_TRACE_PATH));
-    _fileSystem = _storePath.getFileSystem(_conf);
+  }
+
+  public void init(Configuration conf) throws IOException {
+    _storePath = new Path(_configuration.get(BLUR_HDFS_TRACE_PATH));
+    _fileSystem = _storePath.getFileSystem(conf);
     _fileSystem.mkdirs(_storePath);
     _daemon = new Thread(new Runnable() {
       @Override


Mime
View raw message