afs commented on issue #1961: URL: https://github.com/apache/jena/issues/1961#issuecomment-1642065732
Thanks for raising this issue. Jena provides: `GraphTxn` from `GraphFactory.createGraphTxn` (new name `Factory` -> `GraphFactory`). `GraphTxn` is thread-safe on each single method call even without calling transaction begin-commit/abort from the application. > I don't quite understand how transactions could help if we have Streams and don't want to put everything in memory. With transactions, iterators from this graph are consistent - they iterator over the data at the time `find()` was called regardless of changes by other threads. It is not a copy. It is MR+SW - readers and writers can run at the same time. TDB2 and TIM (the dataset for transactional use in-memory behind `GarphTxn`) do not throw away the state of the database until all usage of that epoch of the database have finished with it. > ONT-API is an implementation of [OWL-API](https://github.com/owlcs/owlapi) api, we can't use transactions, there are RW-lock mechanism. Could you expand on that? Why "can't"? There are various problems that arise that ACID transactions address. Protecting the graph datastructures is one part of that - having a consistency view of the data is another. > `SynchronizedGraph` & `ReadWriteLockingGraph` These seem to protect individual operations but not a sequence of operations (the A in ACID). E.g. adding several triples. So datastructure are protected but application can see half-completed changes. I'm not sure the `remember()` function helps - it seems to only protect at each step of an iterator. But if the base data changes during an iterators life between calls to next(), it may thrown ConcurrentModificationException and if it doesn't may not give correct iteration, missing out or duplicating items. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
