Mercurial Hosting > luan
diff src/goodjava/lucene/logging/LoggingIndexWriter.java @ 1508:86c5e7000ecf
lucene.backup checksum
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 16 May 2020 17:56:02 -0600 |
parents | f443542d8650 |
children | 31b543826ca9 |
line wrap: on
line diff
--- a/src/goodjava/lucene/logging/LoggingIndexWriter.java Sat May 16 12:33:41 2020 +0300 +++ b/src/goodjava/lucene/logging/LoggingIndexWriter.java Sat May 16 17:56:02 2020 -0600 @@ -230,13 +230,21 @@ public void check(SortField sortField) throws IOException { if( isChecking ) throw new RuntimeException("another check is running"); + isChecking = true; + try { + doCheck(sortField); + } finally { + isChecking = false; + } + } + + protected void doCheck(SortField sortField) throws IOException { IndexReader indexReader; List<LogInputStream> logReaders; synchronized(this) { indexReader = indexWriter.openReader(); logReaders = logReaders(logs); } - isChecking = true; try { logger.info("check start"); indexWriter.check(); @@ -302,7 +310,6 @@ IoUtils.deleteRecursively(dirFile); logger.info("check done"); } finally { - isChecking = false; indexReader.close(); } }