Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

What is the technical reason for the single JVM restriction? #361

Answered by rdebusscher
Warhorst asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

The rule is that only a single JVM/ single PersistenceManager can write to the persistent store. When you have multiple instances pointing to the same directory with data, they both start writing independently from each to it and will corrupt the storage. The data on the disk will not match the Java objects in memory anymore.

When you have multiple threads modifying the object graph that is assigned the root for MicroStream, you need to apply concurrency guarantees (unless your changes are atomic like assigning a new value for a String variable). You can make use of the ReentrantReadWriteLock class of Java and the readLock and writeLock methods, to make sure that no other threads are …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Warhorst
Comment options

Answer selected by Warhorst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants