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

Kai Reinhard
08.33.2019 2725e9f3e52b008e28019a148cae4b58fc6dc69c
ConcurrentModificationException on queue: synchronized added.
1 files modified
4 ■■■■ changed files
borgbutler-core/src/main/java/de/micromata/borgbutler/jobs/JobQueue.java 4 ●●●● patch | view | raw | blame | history
borgbutler-core/src/main/java/de/micromata/borgbutler/jobs/JobQueue.java
@@ -38,8 +38,10 @@
    }
    public Iterator<AbstractJob<T>> getQueueIterator() {
        synchronized (queue) {
        return Collections.unmodifiableList(queue).iterator();
    }
    }
    /**
     * Searches only for queued jobs (not done jobs).
@@ -48,6 +50,7 @@
     * @return The job if any job with the given unique job number is queued, otherwise null.
     */
    public AbstractJob<T> getQueuedJobByUniqueJobNumber(long uniqueJobNumber) {
        synchronized (queue) {
        Iterator<AbstractJob<T>> it = queue.iterator();
        while (it.hasNext()) {
            AbstractJob<T> job = it.next();
@@ -55,6 +58,7 @@
                return job;
            }
        }
        }
        return null;
    }