incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From twilli...@apache.org
Subject git commit: throw exception if configs not set before initialization - blur-25
Date Thu, 27 Sep 2012 09:56:44 GMT
Updated Branches:
  refs/heads/blur-25-cluster-config 234521201 -> d0a43ac58


throw exception if configs not set before initialization - blur-25


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

Branch: refs/heads/blur-25-cluster-config
Commit: d0a43ac58d29268a14a642e46bfdae77743f6a41
Parents: 2345212
Author: Tim <williamstw@gmail.com>
Authored: Thu Sep 27 05:56:20 2012 -0400
Committer: Tim <williamstw@gmail.com>
Committed: Thu Sep 27 05:56:20 2012 -0400

----------------------------------------------------------------------
 .../org/apache/blur/thrift/BlurShardServer.java    |    7 ++++---
 .../apache/blur/thrift/BlurShardServerTest.java    |    5 ++++-
 2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d0a43ac5/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java b/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
index 4c40908..507359b 100644
--- a/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
+++ b/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
@@ -70,16 +70,17 @@ public class BlurShardServer extends TableAdmin implements Iface {
   private String _cluster = BlurConstants.BLUR_CLUSTER;
   private int _dataFetchThreadCount = 32;
 
-  public void init() {
+  public void init() throws BlurException {
     _queryCache = new QueryCache("shard-cache", _maxQueryCacheElements, _maxTimeToLive);
     _dataFetch = Executors.newThreadPool("data-fetch-", _dataFetchThreadCount);
     
-    if(_configuration != null) {
+    if(_configuration == null) {
+      throw new BException("Configuration must be set before initialization.");
+    }
       _cluster = _configuration.get(BlurConstants.BLUR_CLUSTER_NAME, BlurConstants.BLUR_CLUSTER);
       _dataFetchThreadCount = _configuration.getInt(BLUR_SHARD_DATA_FETCH_THREAD_COUNT, 8);
       _maxQueryCacheElements = _configuration.getInt(BLUR_SHARD_CACHE_MAX_QUERYCACHE_ELEMENTS,
128);
       _maxTimeToLive = _configuration.getLong(BLUR_SHARD_CACHE_MAX_TIMETOLIVE, TimeUnit.MINUTES.toMillis(1));
     
-    }
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d0a43ac5/src/blur-core/src/test/java/org/apache/blur/thrift/BlurShardServerTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/org/apache/blur/thrift/BlurShardServerTest.java b/src/blur-core/src/test/java/org/apache/blur/thrift/BlurShardServerTest.java
index d688d19..8fc566b 100644
--- a/src/blur-core/src/test/java/org/apache/blur/thrift/BlurShardServerTest.java
+++ b/src/blur-core/src/test/java/org/apache/blur/thrift/BlurShardServerTest.java
@@ -22,10 +22,12 @@ import java.util.List;
 import java.util.Map;
 import java.util.SortedSet;
 
+import org.apache.blur.BlurConfiguration;
 import org.apache.blur.analysis.BlurAnalyzer;
 import org.apache.blur.manager.IndexManager;
 import org.apache.blur.manager.IndexServer;
 import org.apache.blur.manager.writer.BlurIndex;
+import org.apache.blur.thrift.generated.BlurException;
 import org.apache.hadoop.io.compress.CompressionCodec;
 import org.apache.lucene.search.Similarity;
 import org.junit.After;
@@ -37,7 +39,7 @@ public class BlurShardServerTest {
   private BlurShardServer blurShardServer;
 
   @Before
-  public void setUp() {
+  public void setUp() throws BlurException, IOException {
     IndexServer indexServer = getIndexServer();
     IndexManager indexManager = getIndexManager();
     indexManager.setIndexServer(indexServer);
@@ -46,6 +48,7 @@ public class BlurShardServerTest {
     blurShardServer = new BlurShardServer();
     blurShardServer.setIndexManager(indexManager);
     blurShardServer.setIndexServer(indexServer);
+    blurShardServer.setConfiguration(new BlurConfiguration());
     blurShardServer.init();
   }
 


Mime
View raw message