From 5fb17be4c786518c79933b8b4c4b56f95d90a4ac Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Fri, 14 Jul 2023 19:07:02 +0200 Subject: [PATCH] Add a method in BackupManager to check if a backup is currently running. --- .../java/fr/pandacube/lib/core/backup/BackupManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupManager.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupManager.java index 50feffd..16e09d7 100644 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupManager.java +++ b/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupManager.java @@ -67,6 +67,9 @@ public class BackupManager extends TimerTask { } + public synchronized boolean isBackupRunning() { + return runningBackup.get() != null; + } public synchronized void run() { @@ -94,7 +97,7 @@ public class BackupManager extends TimerTask { schedulerTimer.cancel(); - if (runningBackup.get() != null) { + if (isBackupRunning()) { Log.warning("[Backup] Waiting after the end of a backup..."); BackupProcess tmp; while ((tmp = runningBackup.get()) != null) {