incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [3/4] git commit: Removed unused parameter in constructor.
Date Tue, 30 Apr 2013 03:17:25 GMT
Removed unused parameter in constructor.


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

Branch: refs/heads/0.1.5
Commit: c9f52d03aeac38078181aa2dfe9a496e78e0e188
Parents: 9092cb8
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Mon Apr 29 23:16:09 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Mon Apr 29 23:16:09 2013 -0400

----------------------------------------------------------------------
 .../blur/manager/writer/BlurIndexReader.java       |  178 +++++++--------
 .../blur/manager/writer/BlurIndexReaderTest.java   |    2 +-
 2 files changed, 87 insertions(+), 93 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/c9f52d03/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexReader.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexReader.java
b/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexReader.java
index ffa64f0..431a829 100644
--- a/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexReader.java
+++ b/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexReader.java
@@ -39,97 +39,91 @@ import org.apache.lucene.store.Directory;
 
 public class BlurIndexReader extends BlurIndex {
 
-	private static final Log LOG = LogFactory.getLog(BlurIndexReader.class);
-
-	private BlurIndexCloser _closer;
-	private Directory _directory;
-	private AtomicReference<DirectoryReader> _indexReaderRef = new AtomicReference<DirectoryReader>();
-	private AtomicBoolean _isClosed = new AtomicBoolean(false);
-	private AtomicBoolean _open = new AtomicBoolean();
-	private BlurIndexRefresher _refresher;
-	private final TableContext _tableContext;
-	private final ShardContext _shardContext;
-
-	public BlurIndexReader(ShardContext shardContext,
-			SharedMergeScheduler mergeScheduler, Directory directory,
-			BlurIndexRefresher refresher, BlurIndexCloser closer)
-			throws IOException {
-		_tableContext = shardContext.getTableContext();
-		_directory = directory;
-		_shardContext = shardContext;
-		_refresher = refresher;
-		_closer = closer;
-		IndexWriterConfig conf = new IndexWriterConfig(LUCENE_VERSION,
-				_tableContext.getAnalyzer());
-		conf.setWriteLockTimeout(TimeUnit.MINUTES.toMillis(5));
-		conf.setIndexDeletionPolicy(_tableContext.getIndexDeletionPolicy());
-		conf.setSimilarity(_tableContext.getSimilarity());
-		TieredMergePolicy mergePolicy = (TieredMergePolicy) conf
-				.getMergePolicy();
-		mergePolicy.setUseCompoundFile(false);
-
-		_open.set(true);
-
-		if (!DirectoryReader.indexExists(directory)) {
-			new IndexWriter(directory, conf).close();
-		}
-		_indexReaderRef.set(DirectoryReader.open(directory));
-		_refresher.register(this);
-	}
-
-	@Override
-	public void refresh() throws IOException {
-		if (!_open.get()) {
-			return;
-		}
-		DirectoryReader oldReader = _indexReaderRef.get();
-		DirectoryReader reader = DirectoryReader.openIfChanged(oldReader);
-		if (reader != null) {
-			_indexReaderRef.set(reader);
-			_closer.close(oldReader);
-		}
-	}
-
-	@Override
-	public void close() throws IOException {
-		_open.set(false);
-	    _refresher.unregister(this);
-	    _directory.close();
-	    _isClosed.set(true);
-		LOG.info("Reader for table [{0}] shard [{1}] closed.", _tableContext.getTable(),_shardContext.getShard());
-	}
-
-	@Override
-	public void replaceRow(boolean waitToBeVisible, boolean wal, Row row)
-			throws IOException {
-		throw new RuntimeException("Read-only shard");
-	}
-
-	@Override
-	public void deleteRow(boolean waitToBeVisible, boolean wal, String rowId)
-			throws IOException {
-		throw new RuntimeException("Read-only shard");
-	}
-
-	@Override
-	public void optimize(int numberOfSegmentsPerShard) throws IOException {
-		// Do nothing
-	}
-
-	@Override
-	public IndexSearcherClosable getIndexReader() throws IOException {
-		throw new RuntimeException("not implemented");
-	}
-
-	@Override
-	public AtomicBoolean isClosed() {
-		 return _isClosed;
-	}
-	
-	public IndexSearcher getSearcher(){
-		IndexReader indexReader = _indexReaderRef.get();
-		indexReader.incRef();
-		return new IndexSearcher(indexReader);
-	}
+  private static final Log LOG = LogFactory.getLog(BlurIndexReader.class);
+
+  private BlurIndexCloser _closer;
+  private Directory _directory;
+  private AtomicReference<DirectoryReader> _indexReaderRef = new AtomicReference<DirectoryReader>();
+  private AtomicBoolean _isClosed = new AtomicBoolean(false);
+  private AtomicBoolean _open = new AtomicBoolean();
+  private BlurIndexRefresher _refresher;
+  private final TableContext _tableContext;
+  private final ShardContext _shardContext;
+
+  public BlurIndexReader(ShardContext shardContext, Directory directory, BlurIndexRefresher
refresher,
+      BlurIndexCloser closer) throws IOException {
+    _tableContext = shardContext.getTableContext();
+    _directory = directory;
+    _shardContext = shardContext;
+    _refresher = refresher;
+    _closer = closer;
+    IndexWriterConfig conf = new IndexWriterConfig(LUCENE_VERSION, _tableContext.getAnalyzer());
+    conf.setWriteLockTimeout(TimeUnit.MINUTES.toMillis(5));
+    conf.setIndexDeletionPolicy(_tableContext.getIndexDeletionPolicy());
+    conf.setSimilarity(_tableContext.getSimilarity());
+    TieredMergePolicy mergePolicy = (TieredMergePolicy) conf.getMergePolicy();
+    mergePolicy.setUseCompoundFile(false);
+
+    _open.set(true);
+
+    if (!DirectoryReader.indexExists(directory)) {
+      new IndexWriter(directory, conf).close();
+    }
+    _indexReaderRef.set(DirectoryReader.open(directory));
+    _refresher.register(this);
+  }
+
+  @Override
+  public void refresh() throws IOException {
+    if (!_open.get()) {
+      return;
+    }
+    DirectoryReader oldReader = _indexReaderRef.get();
+    DirectoryReader reader = DirectoryReader.openIfChanged(oldReader);
+    if (reader != null) {
+      _indexReaderRef.set(reader);
+      _closer.close(oldReader);
+    }
+  }
+
+  @Override
+  public void close() throws IOException {
+    _open.set(false);
+    _refresher.unregister(this);
+    _directory.close();
+    _isClosed.set(true);
+    LOG.info("Reader for table [{0}] shard [{1}] closed.", _tableContext.getTable(), _shardContext.getShard());
+  }
+
+  @Override
+  public void replaceRow(boolean waitToBeVisible, boolean wal, Row row) throws IOException
{
+    throw new RuntimeException("Read-only shard");
+  }
+
+  @Override
+  public void deleteRow(boolean waitToBeVisible, boolean wal, String rowId) throws IOException
{
+    throw new RuntimeException("Read-only shard");
+  }
+
+  @Override
+  public void optimize(int numberOfSegmentsPerShard) throws IOException {
+    // Do nothing
+  }
+
+  @Override
+  public IndexSearcherClosable getIndexReader() throws IOException {
+    throw new RuntimeException("not implemented");
+  }
+
+  @Override
+  public AtomicBoolean isClosed() {
+    return _isClosed;
+  }
+
+  public IndexSearcher getSearcher() {
+    IndexReader indexReader = _indexReaderRef.get();
+    indexReader.incRef();
+    return new IndexSearcher(indexReader);
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/c9f52d03/src/blur-core/src/test/java/org/apache/blur/manager/writer/BlurIndexReaderTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/org/apache/blur/manager/writer/BlurIndexReaderTest.java
b/src/blur-core/src/test/java/org/apache/blur/manager/writer/BlurIndexReaderTest.java
index 68bbd36..f74bb1b 100644
--- a/src/blur-core/src/test/java/org/apache/blur/manager/writer/BlurIndexReaderTest.java
+++ b/src/blur-core/src/test/java/org/apache/blur/manager/writer/BlurIndexReaderTest.java
@@ -91,7 +91,7 @@ public class BlurIndexReaderTest {
     BlurIndexCloser indexCloser = new BlurIndexCloser();
     refresher.init();
     indexCloser.init();
-    reader = new BlurIndexReader(shardContext, mergeScheduler, directory, refresher, indexCloser);
+    reader = new BlurIndexReader(shardContext, directory, refresher, indexCloser);
   }
 
   @After


Mime
View raw message