diff src/goodjava/lucene/logging/LoggingIndexWriter.java @ 1487:044a360c2300

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 01 May 2020 16:17:20 -0600
parents 2469aa31f31b
children af55cfad6e12
line wrap: on
line diff
--- a/src/goodjava/lucene/logging/LoggingIndexWriter.java	Fri May 01 16:09:35 2020 -0600
+++ b/src/goodjava/lucene/logging/LoggingIndexWriter.java	Fri May 01 16:17:20 2020 -0600
@@ -217,18 +217,18 @@
 		}
 	}
 
+	private volatile boolean isChecking = false;
+
 	public void check(SortField sortField) throws IOException {
+		if( isChecking )
+			throw new RuntimeException("another check is running");
 		IndexReader indexReader;
 		List<LogInputStream> logReaders;
 		synchronized(this) {
-			if( isMerging ) {
-				logger.warn("is merging, check aborted");
-				return;
-			}
-			isMerging = true;
 			indexReader = indexWriter.openReader();
 			logReaders = logReaders(logs);
 		}
+		isChecking = true;
 		try {
 			logger.info("check start");
 			indexWriter.check();
@@ -294,8 +294,8 @@
 			IoUtils.deleteRecursively(dirFile);
 			logger.info("check done");
 		} finally {
+			isChecking = false;
 			indexReader.close();
-			isNotMerging();
 		}
 	}