-
Notifications
You must be signed in to change notification settings - Fork 647
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
Support passing a custom TransactionalSystem
in TDB2StorageBuilder
#2200
Comments
Interesting! This style of usage wasn't in the design space so, in a touch of caution, note that the current usage patterns may go deep inside the code. For example, there isn't a per-transaction state object passed to every operation, it's implicit via I see no problem providing for adding a other The usual Are you planning on using any of Jena's transaction system implementation or having a separate implementation? See also The The "non-exclusive" mode is normal mode (multiple reader and single writer (MR+SW)l transactions run non-exclusive. |
Thank you for your answer! |
Version
4.10.0
Feature
I want to use Jena in a cats-effect Scala application.
Cats Effect uses an asynchronous runtime that implements many concurrency constructs in a "semantic" fashion (for example, blocking on a lock is implemented by waiting to execute a callback, instead of using an actual Java lock).
Cats Effect programs are split into many consecutive callbacks which are then executed by their runtime. The runtime uses many threads that execute the next action available for execution.
With Cats Effect I can implement transactions, but they don't work with Jena, since Jena assumes that your code runs sequentially on the same thread. This assumption is reflected in many places.
In TransactionalBase Jena maintains a
ThreadLocal
of aTransaction
so only one can exist per thread.In TransactionCoordinator Jena uses a
ReentrantReadWriteLock
which doesn't allow to lock it from a thread and unlock it from another.In normal Java code, this makes sense since it's highly unsafe to lock from one thread and unlock from another.
But in Cats Effect code there are other safeguards to make sure that no race conditions happen.
I would like to customize TDB2 to allow using my own
TransactionalSystem
, but this is impossible at the moment since the only way to construct aTDB2StorageBuilder
is via itsbuild
static methods which hardcode the TransactionalSystem to useTransactionalBase
here.If I can implement my own
TransactionalSystem
I think I can disable the built-in transactionality and enforce it in other ways.Are you interested in contributing a solution yourself?
None
The text was updated successfully, but these errors were encountered: