Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-5210 Enable implementing sails to benefit from parent sail buffering #5211

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you annotate this with @experimental so that we can adjust the signature down the line if we need to?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing!

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
Loading