diff --git a/core/sail/base/src/main/java/org/eclipse/rdf4j/sail/base/Changeset.java b/core/sail/base/src/main/java/org/eclipse/rdf4j/sail/base/Changeset.java index 4a7b8f431a4..df91107c81c 100644 --- a/core/sail/base/src/main/java/org/eclipse/rdf4j/sail/base/Changeset.java +++ b/core/sail/base/src/main/java/org/eclipse/rdf4j/sail/base/Changeset.java @@ -75,9 +75,9 @@ T get() { } } - AdderBasedReadWriteLock readWriteLock = new AdderBasedReadWriteLock(); - AdderBasedReadWriteLock refBacksReadWriteLock = new AdderBasedReadWriteLock(); - Semaphore prependLock = new Semaphore(1); + final AdderBasedReadWriteLock readWriteLock = new AdderBasedReadWriteLock(); + final AdderBasedReadWriteLock refBacksReadWriteLock = new AdderBasedReadWriteLock(); + final Semaphore prependLock = new Semaphore(1); /** * Set of {@link SailDataset}s that are currently using this {@link Changeset} to derive the state of the @@ -251,16 +251,17 @@ public void addRefback(SailDatasetImpl dataset) { } public void removeRefback(SailDatasetImpl dataset) { - assert !closed; - long writeLock = refBacksReadWriteLock.writeLock(); - try { - if (refbacks != null) { - refbacks.removeIf(d -> d == dataset); + if (refbacks != null) { + // assert !closed; + long writeLock = refBacksReadWriteLock.writeLock(); + try { + if (refbacks != null) { + refbacks.removeIf(d -> d == dataset); + } + } finally { + refBacksReadWriteLock.unlockWriter(writeLock); } - } finally { - refBacksReadWriteLock.unlockWriter(writeLock); } - } public boolean isRefback() {