Mercurial Hosting > luan
comparison 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 |
comparison
equal
deleted
inserted
replaced
1499:22e15cf73040 | 1500:f01abd6d5858 |
---|---|
65 | 65 |
66 private void sync() throws IOException { | 66 private void sync() throws IOException { |
67 List<LogFile> logs = new ArrayList<LogFile>(); | 67 List<LogFile> logs = new ArrayList<LogFile>(); |
68 synchronized(this) { | 68 synchronized(this) { |
69 isSyncPending = false; | 69 isSyncPending = false; |
70 for( File f : dir.listFiles() ) { | 70 clearDir(); |
71 IoUtils.delete(f); | |
72 } | |
73 for( LogFile log : this.logs ) { | 71 for( LogFile log : this.logs ) { |
74 File f = new File(dir,log.file.getName()); | 72 File f = new File(dir,log.file.getName()); |
75 IoUtils.link(log.file,f); | 73 IoUtils.link(log.file,f); |
76 logs.add( new LogFile(f) ); | 74 logs.add( new LogFile(f) ); |
77 } | 75 } |
116 } catch(RpcException e) { | 114 } catch(RpcException e) { |
117 logger.warn("",e); | 115 logger.warn("",e); |
118 } | 116 } |
119 rpc.close(); | 117 rpc.close(); |
120 } | 118 } |
119 clearDir(); | |
120 } | |
121 | |
122 private void clearDir() throws IOException { | |
123 for( File f : dir.listFiles() ) { | |
124 IoUtils.delete(f); | |
125 } | |
121 } | 126 } |
122 | 127 |
123 static RpcClient rpcClient(String backupDomain) throws IOException { | 128 static RpcClient rpcClient(String backupDomain) throws IOException { |
124 Socket socket; | 129 Socket socket; |
125 if( BackupServer.cipherSuites == null ) { | 130 if( BackupServer.cipherSuites == null ) { |