You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@jena.apache.org by "afs (via GitHub)" <gi...@apache.org> on 2023/08/20 11:19:10 UTC
[GitHub] [jena] afs commented on a diff in pull request #1994: jena-core: add more javadocs about Graph-mem thread-safety and ConcurrentModificationException
afs commented on code in PR #1994:
URL: https://github.com/apache/jena/pull/1994#discussion_r1299359073
##########
jena-core/src/main/java/org/apache/jena/graph/GraphMemFactory.java:
##########
@@ -30,8 +30,17 @@
/**
* A factory class for creating memory Graphs.
* <p>
- * Apache Jena is migrating to term semantics graph for consistency across all in-memory and persistent storage graphs
- *
+ * Apache Jena is migrating to term semantics graph for consistency across all in-memory and persistent storage graphs.
+ * <p>
+ * All the graphs that this factory creates are <strong>not thread-safe</strong>.
+ * Note that if the memory Graph is structurally modified at any time after
+ * the iterator has been created by any of the {@code find*} or {@code stream*} methods, the iterator may throw
+ * a {@link java.util.ConcurrentModificationException ConcurrentModificationException}
+ * if continued with it after this modification.
+ * This may happen even if the queried data does not relate directly to modified data
+ * (i.e. when triple search pattern does not match added or deleted triple).
+ * The good practice is to explicitly close iterators immediately after a read operation or
+ * use terminate operations such as {@link ExtendedIterator#toList()}.
Review Comment:
"terminal" is slightly different - it does not necessary read the whole stream (e.g. `findFirst`) but there is an internal "steam close" call .
`ExtendedIterator` does not this hidden close for partially consumed iterators. It's run-to-end or call `ExtendedIterator.close`. `materialising` is running to the end.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org