Skip to content

Commit e7a04f5

Browse files
committed
GH-5210 Enable implementing sails to benefit from parent sail buffering
1 parent 4ffab75 commit e7a04f5

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

core/sail/api/src/main/java/org/eclipse/rdf4j/sail/helpers/AbstractSailConnection.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.concurrent.locks.LockSupport;
2525
import java.util.concurrent.locks.ReentrantLock;
2626

27+
import org.eclipse.rdf4j.common.annotation.Experimental;
2728
import org.eclipse.rdf4j.common.annotation.InternalUseOnly;
2829
import org.eclipse.rdf4j.common.concurrent.locks.Lock;
2930
import org.eclipse.rdf4j.common.concurrent.locks.diagnostics.ConcurrentCleaner;
@@ -733,10 +734,8 @@ protected void endUpdateInternal(UpdateContext op) throws SailException {
733734
synchronized (added) {
734735
model = added.remove(op);
735736
}
736-
if (model != null) {
737-
for (Statement st : model) {
738-
addStatementInternal(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext());
739-
}
737+
if (model != null && !model.isEmpty()) {
738+
bulkAddStatementsInternal(model);
740739
}
741740
}
742741

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

975+
@Experimental
976+
protected void bulkAddStatementsInternal(final Collection<? extends Statement> statements)
977+
throws SailException {
978+
for (final Statement st : statements) {
979+
addStatementInternal(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext());
980+
}
981+
}
982+
976983
protected abstract void removeStatementsInternal(Resource subj, IRI pred, Value obj, Resource... contexts)
977984
throws SailException;
978985

0 commit comments

Comments
 (0)