comparison src/goodjava/lucene/backup/BackupIndexWriter.java @ 1673:1b9f9fdb3b41

remove backup password
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 28 May 2022 21:00:30 -0600
parents 8dd8c556c449
children af18eacf187c
comparison
equal deleted inserted replaced
1672:8dd8c556c449 1673:1b9f9fdb3b41
28 28
29 public final class BackupIndexWriter extends LoggingIndexWriter { 29 public final class BackupIndexWriter extends LoggingIndexWriter {
30 private static final Logger logger = LoggerFactory.getLogger(BackupIndexWriter.class); 30 private static final Logger logger = LoggerFactory.getLogger(BackupIndexWriter.class);
31 public static String[] backupDomains; 31 public static String[] backupDomains;
32 private final String name; 32 private final String name;
33 private final String password;
34 private final File dir; 33 private final File dir;
35 private boolean isSyncPending = false; 34 private boolean isSyncPending = false;
36 private final ExecutorService exec = Executors.newSingleThreadExecutor(); 35 private final ExecutorService exec = Executors.newSingleThreadExecutor();
37 36
38 public BackupIndexWriter(LuceneIndexWriter indexWriter,File logDir,long logTime,String name,String password) 37 public BackupIndexWriter(LuceneIndexWriter indexWriter,File logDir,long logTime,String name)
39 throws IOException 38 throws IOException
40 { 39 {
41 super(indexWriter,logDir,logTime); 40 super(indexWriter,logDir,logTime);
42 if( backupDomains == null ) 41 if( backupDomains == null )
43 throw new RuntimeException("must set backupDomains"); 42 throw new RuntimeException("must set backupDomains");
44 this.name = name; 43 this.name = name;
45 this.password = password;
46 File f = new File(System.getProperty("java.io.tmpdir")); 44 File f = new File(System.getProperty("java.io.tmpdir"));
47 dir = new File(f,"goodjava.lucene/"+name); 45 dir = new File(f,"goodjava.lucene/"+name);
48 IoUtils.mkdirs(dir); 46 IoUtils.mkdirs(dir);
49 } 47 }
50 48
137 logMap.put(log.file.getName(),log); 135 logMap.put(log.file.getName(),log);
138 } 136 }
139 for( String backupDomain : backupDomains ) { 137 for( String backupDomain : backupDomains ) {
140 RpcClient rpc = BackupServer.rpcClient(backupDomain); 138 RpcClient rpc = BackupServer.rpcClient(backupDomain);
141 try { 139 try {
142 RpcCall call = new RpcCall("login",name,password); 140 RpcCall call = new RpcCall("login",name);
143 rpc.write(call); 141 rpc.write(call);
144 rpc.read(); 142 rpc.read();
145 call = new RpcCall("check",logInfo); 143 call = new RpcCall("check",logInfo);
146 while(true) { 144 while(true) {
147 rpc.write(call); 145 rpc.write(call);