From 6cd8aa2c80841b8d19f7fd7566f2fec0204d267d Mon Sep 17 00:00:00 2001 From: Keuin Date: Sat, 20 Jan 2024 00:58:31 +0800 Subject: [PATCH] make copier final --- .../manager/IncrementalBackupStorageManager.java | 10 ++++++---- .../method/ConfiguredIncrementalBackupMethod.java | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/keuin/kbackupfabric/backup/incremental/manager/IncrementalBackupStorageManager.java b/src/main/java/com/keuin/kbackupfabric/backup/incremental/manager/IncrementalBackupStorageManager.java index 53143f8..a8801f6 100644 --- a/src/main/java/com/keuin/kbackupfabric/backup/incremental/manager/IncrementalBackupStorageManager.java +++ b/src/main/java/com/keuin/kbackupfabric/backup/incremental/manager/IncrementalBackupStorageManager.java @@ -30,21 +30,23 @@ public class IncrementalBackupStorageManager { private final Logger logger = Logger.getLogger(IncrementalBackupStorageManager.class.getName()); private final Path backupStorageBase; private final Logger LOGGER = Logger.getLogger(IncrementalBackupStorageManager.class.getName()); - private FileCopier copier; + private final FileCopier copier; public IncrementalBackupStorageManager(Path backupStorageBase) { this.backupStorageBase = backupStorageBase; + FileCopier copier; if (KBackupConfig.getInstance().getIncbakCow()) { // try to use cow copier, if failed, fallback to normal copier try { - this.copier = FileCowCopier.getInstance(); + copier = FileCowCopier.getInstance(); } catch (Exception | UnsatisfiedLinkError ex) { PrintUtil.error("Failed to initialize kbackup-cow: " + ex + ex.getMessage()); - this.copier = new FileEagerCopier(); + copier = new FileEagerCopier(); } } else { - this.copier = new FileEagerCopier(); + copier = new FileEagerCopier(); } + this.copier = copier; if (this.copier.isCow()) { PrintUtil.info("Copy-on-write is enabled"); } else { diff --git a/src/main/java/com/keuin/kbackupfabric/operation/backup/method/ConfiguredIncrementalBackupMethod.java b/src/main/java/com/keuin/kbackupfabric/operation/backup/method/ConfiguredIncrementalBackupMethod.java index 3d9007d..3e85f13 100644 --- a/src/main/java/com/keuin/kbackupfabric/operation/backup/method/ConfiguredIncrementalBackupMethod.java +++ b/src/main/java/com/keuin/kbackupfabric/operation/backup/method/ConfiguredIncrementalBackupMethod.java @@ -46,7 +46,7 @@ public ConfiguredIncrementalBackupMethod(String backupIndexFileName, String leve @Override public IncrementalBackupFeedback backup() { final int hashFactoryThreads = ThreadingUtil.getRecommendedThreadCount(); // how many threads do we use to generate the hash tree - LOGGER.info("Threads: " + hashFactoryThreads); + PrintUtil.info("Threads: " + hashFactoryThreads); // needed in abort progress File levelPathFile = new File(levelPath);