@@ -244,20 +244,13 @@ public void run() {
244
244
try {
245
245
info (info () ? "Stabilizing nodes" : null );
246
246
stable ();
247
- // long saveInterval = config.getConfig(DSLinkConfig.CFG_SAVE_INTERVAL, 60);
248
- // saveInterval *= 60000;
249
- // long nextSave = System.currentTimeMillis() + saveInterval;
250
247
while (isRunning ()) {
251
248
synchronized (this ) {
252
249
try {
253
250
wait (10000 );
254
251
} catch (InterruptedException x ) {
255
252
warn (getPath (), x );
256
253
}
257
- // if (System.currentTimeMillis() > nextSave) {
258
- // save();
259
- // nextSave = System.currentTimeMillis() + saveInterval;
260
- // }
261
254
}
262
255
}
263
256
} catch (Exception x ) {
@@ -283,85 +276,6 @@ protected void onStopped() {
283
276
}
284
277
}
285
278
286
- // /**
287
- // * Serializes the configuration database.
288
- // */
289
- // public void save() {
290
- // if (!saveEnabled) {
291
- // return;
292
- // }
293
- // ZipOutputStream zos = null;
294
- // InputStream in = null;
295
- // try {
296
- // File nodes = config.getNodesFile();
297
- // String name = nodes.getName();
298
- // if (nodes.exists()) {
299
- // info("Backing up the node database...");
300
- // StringBuilder buf = new StringBuilder();
301
- // Calendar cal = DSTime.getCalendar(System.currentTimeMillis());
302
- // if (name.endsWith(".zip")) {
303
- // String tmp = name.substring(0, name.lastIndexOf(".zip"));
304
- // buf.append(tmp).append('.');
305
- // DSTime.encodeForFiles(cal, buf);
306
- // buf.append(".zip");
307
- // File bakFile = new File(nodes.getParent(), buf.toString());
308
- // nodes.renameTo(bakFile);
309
- // } else {
310
- // buf.append(name).append('.');
311
- // DSTime.encodeForFiles(cal, buf);
312
- // buf.append(".zip");
313
- // File back = new File(nodes.getParent(), buf.toString());
314
- // FileOutputStream fos = new FileOutputStream(back);
315
- // zos = new ZipOutputStream(fos);
316
- // zos.putNextEntry(new ZipEntry(nodes.getName()));
317
- // byte[] b = new byte[4096];
318
- // in = new FileInputStream(nodes);
319
- // int len = in.read(b);
320
- // while (len > 0) {
321
- // zos.write(b, 0, len);
322
- // len = in.read(b);
323
- // }
324
- // in.close();
325
- // in = null;
326
- // zos.closeEntry();
327
- // zos.close();
328
- // zos = null;
329
- // }
330
- // DSTime.recycle(cal);
331
- // }
332
- // long time = System.currentTimeMillis();
333
- // info("Saving node database " + nodes.getAbsolutePath());
334
- // JsonWriter writer = null;
335
- // if (name.endsWith(".zip")) {
336
- // String tmp = name.substring(0, name.lastIndexOf(".zip"));
337
- // writer = new JsonWriter(nodes, tmp + ".json");
338
- // } else {
339
- // writer = new JsonWriter(nodes);
340
- // }
341
- // NodeEncoder.encode(writer, this);
342
- // writer.close();
343
- // trimBackups();
344
- // time = System.currentTimeMillis() - time;
345
- // info("Node database saved: " + time + "ms");
346
- // } catch (Exception x) {
347
- // error("Saving node database", x);
348
- // }
349
- // try {
350
- // if (in != null) {
351
- // in.close();
352
- // }
353
- // } catch (IOException x) {
354
- // error("Closing input", x);
355
- // }
356
- // try {
357
- // if (zos != null) {
358
- // zos.close();
359
- // }
360
- // } catch (IOException x) {
361
- // error("Closing output", x);
362
- // }
363
- // }
364
-
365
279
/**
366
280
* Properly shuts down the link when a thread is executing the run method.
367
281
*/
0 commit comments