diff src/goodjava/lucene/backup/BackupIndexWriter.java @ 1500:f01abd6d5858

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 10 May 2020 13:06:11 -0600
parents 22e15cf73040
children e66e3d50b289
line wrap: on
line diff
--- a/src/goodjava/lucene/backup/BackupIndexWriter.java	Sat May 09 23:14:13 2020 -0600
+++ b/src/goodjava/lucene/backup/BackupIndexWriter.java	Sun May 10 13:06:11 2020 -0600
@@ -67,9 +67,7 @@
 		List<LogFile> logs = new ArrayList<LogFile>();
 		synchronized(this) {
 			isSyncPending = false;
-			for( File f : dir.listFiles() ) {
-				IoUtils.delete(f);
-			}
+			clearDir();
 			for( LogFile log : this.logs ) {
 				File f = new File(dir,log.file.getName());
 				IoUtils.link(log.file,f);
@@ -118,6 +116,13 @@
 			}
 			rpc.close();
 		}
+		clearDir();
+	}
+
+	private void clearDir() throws IOException {
+		for( File f : dir.listFiles() ) {
+			IoUtils.delete(f);
+		}
 	}
 
 	static RpcClient rpcClient(String backupDomain) throws IOException {