Skip to content

Commit

Permalink
GH-5210 Enable implementing sails to benefit from parent sail bufferi…
Browse files Browse the repository at this point in the history
…ng (#5211)
  • Loading branch information
hmottestad authored Dec 27, 2024
2 parents 4ffab75 + e7a04f5 commit 1ea1589
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.concurrent.locks.LockSupport;
import java.util.concurrent.locks.ReentrantLock;

import org.eclipse.rdf4j.common.annotation.Experimental;
import org.eclipse.rdf4j.common.annotation.InternalUseOnly;
import org.eclipse.rdf4j.common.concurrent.locks.Lock;
import org.eclipse.rdf4j.common.concurrent.locks.diagnostics.ConcurrentCleaner;
Expand Down Expand Up @@ -733,10 +734,8 @@ protected void endUpdateInternal(UpdateContext op) throws SailException {
synchronized (added) {
model = added.remove(op);
}
if (model != null) {
for (Statement st : model) {
addStatementInternal(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext());
}
if (model != null && !model.isEmpty()) {
bulkAddStatementsInternal(model);
}
}

Expand Down Expand Up @@ -973,6 +972,14 @@ protected void prepareInternal() throws SailException {
protected abstract void addStatementInternal(Resource subj, IRI pred, Value obj, Resource... contexts)
throws SailException;

@Experimental
protected void bulkAddStatementsInternal(final Collection<? extends Statement> statements)
throws SailException {
for (final Statement st : statements) {
addStatementInternal(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext());
}
}

protected abstract void removeStatementsInternal(Resource subj, IRI pred, Value obj, Resource... contexts)
throws SailException;

Expand Down

0 comments on commit 1ea1589

Please sign in to comment.