mirror of https://github.com/micromata/borgbackup-butler.git

Kai Reinhard
06.08.2019 3b6408569b692bf2c12d8b3e355d3fba5c41a41a
borgbutler-core/src/main/java/de/micromata/borgbutler/BorgQueueExecutor.java
@@ -15,6 +15,7 @@
public class BorgQueueExecutor {
    private Logger log = LoggerFactory.getLogger(BorgQueueExecutor.class);
    private static final BorgQueueExecutor instance = new BorgQueueExecutor();
    private static final String NONE_REPO_QUEUE = "--NO_REPO--";
    public static BorgQueueExecutor getInstance() {
        return instance;
@@ -23,6 +24,25 @@
    // key is the repo name.
    private Map<String, JobQueue<String>> queueMap = new HashMap<>();
    public BorgQueueStatistics getStatistics() {
        BorgQueueStatistics statistics = new BorgQueueStatistics();
        Iterator<JobQueue<String>> it = queueMap.values().iterator();
        while (it.hasNext()) {
            JobQueue<?> queue = it.next();
            statistics.totalNumberOfQueues++;
            int queueSize = queue.getQueueSize();
            if (queueSize > 0) {
                statistics.numberOfActiveQueues++;
                statistics.numberOfRunningAndQueuedJobs += queueSize;
            }
            int oldJobsSize = queue.getOldJobsSize();
            if (oldJobsSize > 0) {
                statistics.numberOfOldJobs += oldJobsSize;
            }
        }
        return statistics;
    }
    /**
     * @return A list of all repos with queues.
     */
@@ -98,7 +118,7 @@
    }
    private String getQueueName(BorgRepoConfig repoConfig) {
        return repoConfig != null ? repoConfig.getId() : "--NO_REPO--";
        return repoConfig != null ? repoConfig.getId() : NONE_REPO_QUEUE;
    }
    public BorgJob<Void> execute(BorgCommand command) {