incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: Refactoring the BlurIndex constructor to take a config object.
Date Fri, 15 Jan 2016 21:13:34 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/master 32cfc6251 -> 97611acf1


Refactoring the BlurIndex constructor to take a 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/97611acf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/97611acf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/97611acf

Branch: refs/heads/master
Commit: 97611acf10e758ce6537b9891356ac38cdc98f16
Parents: 32cfc62
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Fri Jan 15 16:13:23 2016 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Fri Jan 15 16:13:23 2016 -0500

----------------------------------------------------------------------
 .../indexserver/DistributedIndexServer.java     |  5 +-
 .../manager/indexserver/LocalIndexServer.java   |  5 +-
 .../apache/blur/manager/writer/BlurIndex.java   | 22 ++---
 .../blur/manager/writer/BlurIndexConf.java      | 94 ++++++++++++++++++++
 .../blur/manager/writer/BlurIndexConfig.java    | 94 ++++++++++++++++++++
 .../blur/manager/writer/BlurIndexReadOnly.java  |  3 +-
 .../manager/writer/BlurIndexSimpleWriter.java   | 34 ++++---
 .../org/apache/blur/server/TableContext.java    | 22 ++---
 .../blur/command/ShardCommandManagerTest.java   |  3 +-
 .../blur/command/stream/StreamServerTest.java   |  3 +-
 .../writer/BlurIndexSimpleWriterTest.java       |  4 +-
 .../blur/manager/writer/IndexImporterTest.java  |  2 +-
 12 files changed, 231 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/97611acf/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
b/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
index c6878d5..6fb5b2f 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
@@ -46,6 +46,7 @@ import org.apache.blur.manager.clusterstatus.ClusterStatus;
 import org.apache.blur.manager.clusterstatus.ClusterStatus.Action;
 import org.apache.blur.manager.writer.BlurIndex;
 import org.apache.blur.manager.writer.BlurIndexCloser;
+import org.apache.blur.manager.writer.BlurIndexConf;
 import org.apache.blur.manager.writer.BlurIndexReadOnly;
 import org.apache.blur.manager.writer.SharedMergeScheduler;
 import org.apache.blur.server.ShardContext;
@@ -526,9 +527,11 @@ public class DistributedIndexServer extends AbstractDistributedIndexServer
{
       directory = _blockCacheDirectoryFactory.newDirectory(table, shard, directory, blockCacheFileTypes);
     }
 
-    BlurIndex index = tableContext.newInstanceBlurIndex(shardContext, directory, _mergeScheduler,
_searchExecutor,
+    BlurIndexConf blurIndexConf = new BlurIndexConf(shardContext, directory, _mergeScheduler,
_searchExecutor,
         _indexCloser, _indexImporterTimer, _indexBulkTimer, _thriftCache, _indexIdleWriterTimer,
_maxWriterIdle);
 
+    BlurIndex index = tableContext.newInstanceBlurIndex(blurIndexConf);
+
     if (_clusterStatus.isReadOnly(true, _cluster, table)) {
       index = new BlurIndexReadOnly(index);
     }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/97611acf/blur-core/src/main/java/org/apache/blur/manager/indexserver/LocalIndexServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/indexserver/LocalIndexServer.java
b/blur-core/src/main/java/org/apache/blur/manager/indexserver/LocalIndexServer.java
index 9470d15..71eb35c 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/indexserver/LocalIndexServer.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/indexserver/LocalIndexServer.java
@@ -35,6 +35,7 @@ import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
 import org.apache.blur.manager.writer.BlurIndex;
 import org.apache.blur.manager.writer.BlurIndexCloser;
+import org.apache.blur.manager.writer.BlurIndexConf;
 import org.apache.blur.manager.writer.BlurIndexSimpleWriter;
 import org.apache.blur.manager.writer.SharedMergeScheduler;
 import org.apache.blur.server.ShardContext;
@@ -157,8 +158,8 @@ public class LocalIndexServer extends AbstractIndexServer {
 
   private BlurIndex openIndex(String table, String shard, Directory dir) throws CorruptIndexException,
IOException {
     ShardContext shardContext = ShardContext.create(_tableContext, shard);
-    BlurIndexSimpleWriter index = new BlurIndexSimpleWriter(shardContext, dir, _mergeScheduler,
_searchExecutor,
-        _indexCloser, _timer, _bulkTimer, null, _closerTimer, _maxWriterIdle);
+    BlurIndexSimpleWriter index = new BlurIndexSimpleWriter(new BlurIndexConf(shardContext,
dir, _mergeScheduler,
+        _searchExecutor, _indexCloser, _timer, _bulkTimer, null, _closerTimer, _maxWriterIdle));
     return index;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/97611acf/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndex.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndex.java b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndex.java
index aac5a86..9721d42 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndex.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndex.java
@@ -18,33 +18,27 @@ package org.apache.blur.manager.writer;
  */
 import java.io.IOException;
 import java.util.List;
-import java.util.Timer;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.blur.lucene.search.IndexSearcherCloseable;
 import org.apache.blur.server.ShardContext;
-import org.apache.blur.server.cache.ThriftCache;
 import org.apache.blur.thrift.generated.RowMutation;
 import org.apache.blur.utils.BlurUtil;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReaderContext;
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.search.TopDocs;
-import org.apache.lucene.store.Directory;
 
 public abstract class BlurIndex {
 
-  private static final long ONE_MINUTE = TimeUnit.MINUTES.toMillis(1);
-  private long _lastMemoryCheck = 0;
-  private long _memoryUsage = 0;
-  protected ShardContext _shardContext;
+  protected final BlurIndexConf _blurIndexConf;
 
-  public BlurIndex(ShardContext shardContext, Directory directory, SharedMergeScheduler mergeScheduler,
-      ExecutorService searchExecutor, BlurIndexCloser indexCloser, Timer indexImporterTimer,
Timer bulkIndexingTimer,
-      ThriftCache thriftCache, Timer indexWriterTimer, long maxWriterIdle) throws IOException
{
-    _shardContext = shardContext;
+  public BlurIndex(BlurIndexConf blurIndexConf) throws IOException {
+    _blurIndexConf = blurIndexConf;
+  }
+
+  public BlurIndexConf getBlurIndexConf() {
+    return _blurIndexConf;
   }
 
   public abstract IndexSearcherCloseable getIndexSearcher() throws IOException;
@@ -130,7 +124,7 @@ public abstract class BlurIndex {
   }
 
   public ShardContext getShardContext() {
-    return _shardContext;
+    return _blurIndexConf.getShardContext();
   }
 
   public abstract void process(IndexAction indexAction) throws IOException;

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/97611acf/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexConf.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexConf.java b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexConf.java
new file mode 100644
index 0000000..2225253
--- /dev/null
+++ b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexConf.java
@@ -0,0 +1,94 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.blur.manager.writer;
+
+import java.util.Timer;
+import java.util.concurrent.ExecutorService;
+
+import org.apache.blur.server.ShardContext;
+import org.apache.blur.server.cache.ThriftCache;
+import org.apache.lucene.store.Directory;
+
+public class BlurIndexConf {
+
+  private final ShardContext _shardContext;
+  private final Directory _directory;
+  private final SharedMergeScheduler _mergeScheduler;
+  private final ExecutorService _searchExecutor;
+  private final BlurIndexCloser _indexCloser;
+  private final Timer _indexImporterTimer;
+  private final Timer _bulkIndexingTimer;
+  private final ThriftCache _thriftCache;
+  private final Timer _indexWriterTimer;
+  private final long _maxWriterIdle;
+
+  public BlurIndexConf(ShardContext shardContext, Directory directory, SharedMergeScheduler
mergeScheduler,
+      ExecutorService searchExecutor, BlurIndexCloser indexCloser, Timer indexImporterTimer,
Timer bulkIndexingTimer,
+      ThriftCache thriftCache, Timer indexWriterTimer, long maxWriterIdle) {
+    _shardContext = shardContext;
+    _directory = directory;
+    _mergeScheduler = mergeScheduler;
+    _searchExecutor = searchExecutor;
+    _indexCloser = indexCloser;
+    _indexImporterTimer = indexImporterTimer;
+    _bulkIndexingTimer = bulkIndexingTimer;
+    _thriftCache = thriftCache;
+    _indexWriterTimer = indexWriterTimer;
+    _maxWriterIdle = maxWriterIdle;
+  }
+
+  public ShardContext getShardContext() {
+    return _shardContext;
+  }
+
+  public Directory getDirectory() {
+    return _directory;
+  }
+
+  public SharedMergeScheduler getMergeScheduler() {
+    return _mergeScheduler;
+  }
+
+  public ExecutorService getSearchExecutor() {
+    return _searchExecutor;
+  }
+
+  public BlurIndexCloser getIndexCloser() {
+    return _indexCloser;
+  }
+
+  public Timer getIndexImporterTimer() {
+    return _indexImporterTimer;
+  }
+
+  public Timer getBulkIndexingTimer() {
+    return _bulkIndexingTimer;
+  }
+
+  public ThriftCache getThriftCache() {
+    return _thriftCache;
+  }
+
+  public Timer getIndexWriterTimer() {
+    return _indexWriterTimer;
+  }
+
+  public long getMaxWriterIdle() {
+    return _maxWriterIdle;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/97611acf/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexConfig.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexConfig.java b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexConfig.java
new file mode 100644
index 0000000..858a826
--- /dev/null
+++ b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexConfig.java
@@ -0,0 +1,94 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.blur.manager.writer;
+
+import java.util.Timer;
+import java.util.concurrent.ExecutorService;
+
+import org.apache.blur.server.ShardContext;
+import org.apache.blur.server.cache.ThriftCache;
+import org.apache.lucene.store.Directory;
+
+public class BlurIndexConfig {
+
+  private final ShardContext _shardContext;
+  private final Directory _directory;
+  private final SharedMergeScheduler _mergeScheduler;
+  private final ExecutorService _searchExecutor;
+  private final BlurIndexCloser _indexCloser;
+  private final Timer _indexImporterTimer;
+  private final Timer _bulkIndexingTimer;
+  private final ThriftCache _thriftCache;
+  private final Timer _indexWriterTimer;
+  private final long _maxWriterIdle;
+
+  public BlurIndexConfig(ShardContext shardContext, Directory directory, SharedMergeScheduler
mergeScheduler,
+      ExecutorService searchExecutor, BlurIndexCloser indexCloser, Timer indexImporterTimer,
Timer bulkIndexingTimer,
+      ThriftCache thriftCache, Timer indexWriterTimer, long maxWriterIdle) {
+    _shardContext = shardContext;
+    _directory = directory;
+    _mergeScheduler = mergeScheduler;
+    _searchExecutor = searchExecutor;
+    _indexCloser = indexCloser;
+    _indexImporterTimer = indexImporterTimer;
+    _bulkIndexingTimer = bulkIndexingTimer;
+    _thriftCache = thriftCache;
+    _indexWriterTimer = indexWriterTimer;
+    _maxWriterIdle = maxWriterIdle;
+  }
+
+  public ShardContext getShardContext() {
+    return _shardContext;
+  }
+
+  public Directory getDirectory() {
+    return _directory;
+  }
+
+  public SharedMergeScheduler getMergeScheduler() {
+    return _mergeScheduler;
+  }
+
+  public ExecutorService getSearchExecutor() {
+    return _searchExecutor;
+  }
+
+  public BlurIndexCloser getIndexCloser() {
+    return _indexCloser;
+  }
+
+  public Timer getIndexImporterTimer() {
+    return _indexImporterTimer;
+  }
+
+  public Timer getBulkIndexingTimer() {
+    return _bulkIndexingTimer;
+  }
+
+  public ThriftCache getThriftCache() {
+    return _thriftCache;
+  }
+
+  public Timer getIndexWriterTimer() {
+    return _indexWriterTimer;
+  }
+
+  public long getMaxWriterIdle() {
+    return _maxWriterIdle;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/97611acf/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexReadOnly.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexReadOnly.java
b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexReadOnly.java
index c0b6ada..328c2ac 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexReadOnly.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexReadOnly.java
@@ -18,7 +18,6 @@ package org.apache.blur.manager.writer;
 
 import java.io.IOException;
 import java.util.List;
-import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.blur.lucene.search.IndexSearcherCloseable;
@@ -29,7 +28,7 @@ public class BlurIndexReadOnly extends BlurIndex {
   private final BlurIndex _blurIndex;
 
   public BlurIndexReadOnly(BlurIndex blurIndex) throws IOException {
-    super(null, null, null, null, null, null, null, null, null, 0);
+    super(blurIndex.getBlurIndexConf());
     _blurIndex = blurIndex;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/97611acf/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
index 20a7440..8aa2f76 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
@@ -155,22 +155,19 @@ public class BlurIndexSimpleWriter extends BlurIndex {
 
   private volatile Thread _optimizeThread;
 
-  public BlurIndexSimpleWriter(ShardContext shardContext, Directory directory, SharedMergeScheduler
mergeScheduler,
-      final ExecutorService searchExecutor, BlurIndexCloser indexCloser, Timer indexImporterTimer,
-      Timer bulkIndexingTimer, ThriftCache thriftCache, Timer indexWriterTimer, long maxWriterIdle)
throws IOException {
-    super(shardContext, directory, mergeScheduler, searchExecutor, indexCloser, indexImporterTimer,
bulkIndexingTimer,
-        thriftCache, indexWriterTimer, maxWriterIdle);
-    _maxWriterIdle = maxWriterIdle;
-    _indexWriterTimer = indexWriterTimer;
-    _thriftCache = thriftCache;
+  public BlurIndexSimpleWriter(BlurIndexConf blurIndexConf) throws IOException {
+    super(blurIndexConf);
+    _maxWriterIdle = blurIndexConf.getMaxWriterIdle();
+    _indexWriterTimer = blurIndexConf.getIndexWriterTimer();
+    _thriftCache = blurIndexConf.getThriftCache();
     _commaSplitter = Splitter.on(',');
     _bulkWriters = new ConcurrentHashMap<String, BlurIndexSimpleWriter.BulkEntry>();
-    _indexImporterTimer = indexImporterTimer;
-    _bulkIndexingTimer = bulkIndexingTimer;
-    _searchThreadPool = searchExecutor;
-    _shardContext = shardContext;
+    _indexImporterTimer = blurIndexConf.getIndexImporterTimer();
+    _bulkIndexingTimer = blurIndexConf.getBulkIndexingTimer();
+    _searchThreadPool = blurIndexConf.getSearchExecutor();
+    _shardContext = blurIndexConf.getShardContext();
     _tableContext = _shardContext.getTableContext();
-    _context = _tableContext.getTable() + "/" + shardContext.getShard();
+    _context = _tableContext.getTable() + "/" + _shardContext.getShard();
     _fieldManager = _tableContext.getFieldManager();
     _discoverableFields = _tableContext.getDiscoverableFields();
     _accessControlFactory = _tableContext.getAccessControlFactory();
@@ -198,7 +195,7 @@ public class BlurIndexSimpleWriter extends BlurIndex {
     _conf.setInfoStream(new LoggingInfoStream(_tableContext.getTable(), _shardContext.getShard()));
     TieredMergePolicy mergePolicy = (TieredMergePolicy) _conf.getMergePolicy();
     mergePolicy.setUseCompoundFile(false);
-    _conf.setMergeScheduler(mergeScheduler.getMergeScheduler());
+    _conf.setMergeScheduler(blurIndexConf.getMergeScheduler().getMergeScheduler());
     _snapshotIndexDeletionPolicy = new SnapshotIndexDeletionPolicy(_tableContext.getConfiguration(),
         SnapshotIndexDeletionPolicy.getGenerationsPath(_shardContext.getHdfsDirPath()));
     _policy = new IndexDeletionPolicyReader(_snapshotIndexDeletionPolicy);
@@ -207,13 +204,12 @@ public class BlurIndexSimpleWriter extends BlurIndex {
     _queue = new ArrayBlockingQueue<RowMutation>(blurConfiguration.getInt(BLUR_SHARD_QUEUE_MAX_INMEMORY_LENGTH,
100));
     _mutationQueueProcessor = new MutationQueueProcessor(_queue, this, _shardContext, _writesWaiting);
 
-    if (!DirectoryReader.indexExists(directory)) {
-      new BlurIndexWriter(directory, _conf).close();
+    _directory = blurIndexConf.getDirectory();
+    if (!DirectoryReader.indexExists(_directory)) {
+      new BlurIndexWriter(_directory, _conf).close();
     }
 
-    _directory = directory;
-
-    _indexCloser = indexCloser;
+    _indexCloser = blurIndexConf.getIndexCloser();
     DirectoryReader realDirectoryReader = DirectoryReader.open(_directory);
     DirectoryReader wrappped = wrap(realDirectoryReader);
     String message = "BlurIndexSimpleWriter - inital open";

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/97611acf/blur-core/src/main/java/org/apache/blur/server/TableContext.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/server/TableContext.java b/blur-core/src/main/java/org/apache/blur/server/TableContext.java
index 375de78..f1722ba 100644
--- a/blur-core/src/main/java/org/apache/blur/server/TableContext.java
+++ b/blur-core/src/main/java/org/apache/blur/server/TableContext.java
@@ -34,9 +34,7 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
-import java.util.Timer;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutorService;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.blur.BlurConfiguration;
@@ -52,11 +50,8 @@ import org.apache.blur.lucene.security.index.AccessControlFactory;
 import org.apache.blur.lucene.security.index.FilterAccessControlFactory;
 import org.apache.blur.manager.ReadInterceptor;
 import org.apache.blur.manager.writer.BlurIndex;
-import org.apache.blur.manager.writer.BlurIndexCloser;
+import org.apache.blur.manager.writer.BlurIndexConf;
 import org.apache.blur.manager.writer.BlurIndexSimpleWriter;
-//import org.apache.blur.manager.writer.BlurNRTIndex;
-import org.apache.blur.manager.writer.SharedMergeScheduler;
-import org.apache.blur.server.cache.ThriftCache;
 import org.apache.blur.thrift.generated.Blur.Iface;
 import org.apache.blur.thrift.generated.ScoreType;
 import org.apache.blur.thrift.generated.TableDescriptor;
@@ -70,7 +65,7 @@ import org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.search.Filter;
 import org.apache.lucene.search.similarities.Similarity;
-import org.apache.lucene.store.Directory;
+//import org.apache.blur.manager.writer.BlurNRTIndex;
 
 public class TableContext implements Cloneable {
 
@@ -368,12 +363,8 @@ public class TableContext implements Cloneable {
   }
 
   @SuppressWarnings("unchecked")
-  public BlurIndex newInstanceBlurIndex(ShardContext shardContext, Directory dir, SharedMergeScheduler
mergeScheduler,
-      ExecutorService searchExecutor, BlurIndexCloser indexCloser, Timer indexImporterTimer,
Timer bulkTimer,
-      ThriftCache thriftCache, Timer indexWriterTimer, long maxWriterIdle) throws IOException
{
-
+  public BlurIndex newInstanceBlurIndex(BlurIndexConf blurIndexConf) throws IOException {
     String className = _blurConfiguration.get(BLUR_SHARD_BLURINDEX_CLASS, BlurIndexSimpleWriter.class.getName());
-
     Class<? extends BlurIndex> clazz;
     try {
       clazz = (Class<? extends BlurIndex>) Class.forName(className);
@@ -382,8 +373,7 @@ public class TableContext implements Cloneable {
     }
     Constructor<? extends BlurIndex> constructor = findConstructor(clazz);
     try {
-      return constructor.newInstance(shardContext, dir, mergeScheduler, searchExecutor, indexCloser,
-          indexImporterTimer, bulkTimer, thriftCache, indexWriterTimer, maxWriterIdle);
+      return constructor.newInstance(blurIndexConf);
     } catch (InstantiationException e) {
       throw new IOException(e);
     } catch (IllegalAccessException e) {
@@ -397,9 +387,7 @@ public class TableContext implements Cloneable {
 
   private Constructor<? extends BlurIndex> findConstructor(Class<? extends BlurIndex>
clazz) throws IOException {
     try {
-      return clazz.getConstructor(new Class[] { ShardContext.class, Directory.class, SharedMergeScheduler.class,
-          ExecutorService.class, BlurIndexCloser.class, Timer.class, Timer.class, ThriftCache.class,
Timer.class,
-          Long.TYPE });
+      return clazz.getConstructor(new Class[] { BlurIndexConf.class });
     } catch (NoSuchMethodException e) {
       throw new IOException(e);
     } catch (SecurityException e) {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/97611acf/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 64bb2d0..5d3205f 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
@@ -38,6 +38,7 @@ import org.apache.blur.lucene.search.IndexSearcherCloseable;
 import org.apache.blur.lucene.search.IndexSearcherCloseableBase;
 import org.apache.blur.manager.IndexServer;
 import org.apache.blur.manager.writer.BlurIndex;
+import org.apache.blur.manager.writer.BlurIndexConf;
 import org.apache.blur.manager.writer.IndexAction;
 import org.apache.blur.server.ShardContext;
 import org.apache.blur.server.TableContext;
@@ -383,7 +384,7 @@ public class ShardCommandManagerTest {
 
   protected BlurIndex getNullBlurIndex(String shard) throws IOException {
     ShardContext shardContext = ShardContext.create(getTableContextFactory().getTableContext("test"),
shard);
-    return new BlurIndex(shardContext, null, null, null, null, null, null, null, null, 0)
{
+    return new BlurIndex(new BlurIndexConf(shardContext, null, null, null, null, null, null,
null, null, 0)) {
 
       @Override
       public void removeSnapshot(String name) throws IOException {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/97611acf/blur-core/src/test/java/org/apache/blur/command/stream/StreamServerTest.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/java/org/apache/blur/command/stream/StreamServerTest.java
b/blur-core/src/test/java/org/apache/blur/command/stream/StreamServerTest.java
index 0e27d4c..c99715c 100644
--- a/blur-core/src/test/java/org/apache/blur/command/stream/StreamServerTest.java
+++ b/blur-core/src/test/java/org/apache/blur/command/stream/StreamServerTest.java
@@ -33,6 +33,7 @@ import org.apache.blur.command.IndexContext;
 import org.apache.blur.lucene.search.IndexSearcherCloseable;
 import org.apache.blur.manager.IndexServer;
 import org.apache.blur.manager.writer.BlurIndex;
+import org.apache.blur.manager.writer.BlurIndexConf;
 import org.apache.blur.manager.writer.IndexAction;
 import org.apache.blur.server.ShardContext;
 import org.apache.blur.server.TableContext;
@@ -211,7 +212,7 @@ public class StreamServerTest implements Serializable {
     tableDescriptor.setTableUri("file:///tmp");
     TableContext tableContext = TableContext.create(tableDescriptor);
     ShardContext shardContext = ShardContext.create(tableContext, shard);
-    return new BlurIndex(shardContext, null, null, null, null, null, null, null, null, 0)
{
+    return new BlurIndex(new BlurIndexConf(shardContext, null, null, null, null, null, null,
null, null, 0)) {
 
       @Override
       public void removeSnapshot(String name) throws IOException {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/97611acf/blur-core/src/test/java/org/apache/blur/manager/writer/BlurIndexSimpleWriterTest.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/java/org/apache/blur/manager/writer/BlurIndexSimpleWriterTest.java
b/blur-core/src/test/java/org/apache/blur/manager/writer/BlurIndexSimpleWriterTest.java
index e4f31ac..a0069b9 100644
--- a/blur-core/src/test/java/org/apache/blur/manager/writer/BlurIndexSimpleWriterTest.java
+++ b/blur-core/src/test/java/org/apache/blur/manager/writer/BlurIndexSimpleWriterTest.java
@@ -128,8 +128,8 @@ public class BlurIndexSimpleWriterTest {
     directory.setLockFactory(lockFactory);
 
     ShardContext shardContext = ShardContext.create(tableContext, "test-shard-" + uuid);
-    _writer = new BlurIndexSimpleWriter(shardContext, directory, _mergeScheduler, _service,
_closer,
-        _indexImporterTimer, _bulkTimer, null, _idleWriterTimer, TimeUnit.SECONDS.toMillis(5));
+    _writer = new BlurIndexSimpleWriter(new BlurIndexConf(shardContext, directory, _mergeScheduler,
_service, _closer,
+        _indexImporterTimer, _bulkTimer, null, _idleWriterTimer, TimeUnit.SECONDS.toMillis(5)));
   }
 
   @After

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/97611acf/blur-core/src/test/java/org/apache/blur/manager/writer/IndexImporterTest.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/java/org/apache/blur/manager/writer/IndexImporterTest.java
b/blur-core/src/test/java/org/apache/blur/manager/writer/IndexImporterTest.java
index 47a308c..60ce6ef 100644
--- a/blur-core/src/test/java/org/apache/blur/manager/writer/IndexImporterTest.java
+++ b/blur-core/src/test/java/org/apache/blur/manager/writer/IndexImporterTest.java
@@ -126,7 +126,7 @@ public class IndexImporterTest {
   }
 
   private BlurIndex getBlurIndex(ShardContext shardContext, final Directory mainDirectory)
throws IOException {
-    return new BlurIndex(shardContext, mainDirectory, null, null, null, null, null, null,
null, 0) {
+    return new BlurIndex(new BlurIndexConf(shardContext, mainDirectory, null, null, null,
null, null, null, null, 0)) {
 
       @Override
       public void removeSnapshot(String name) throws IOException {


Mime
View raw message