There is an application that will need to have something like a look up table. This application can be started many times with different configurations. Is there a way to share a datastructure across JVMs. static
would be valid within a JVM. Having a database would solve the issue. However, is there something simpler and fast?
Asked
Active
Viewed 853 times
2

user592748
- 1,194
- 3
- 21
- 45
-
http://terracotta.org/ is a product that solves some very similar tasks. – yole Mar 04 '15 at 09:38
-
possible duplicate of [Any concept of shared memory in Java](http://stackoverflow.com/questions/1491519/any-concept-of-shared-memory-in-java) – CupawnTae Mar 04 '15 at 09:39
-
1Some answers here http://stackoverflow.com/questions/1491519/any-concept-of-shared-memory-in-java and here http://stackoverflow.com/questions/25396664/shared-memory-between-two-jvms – CupawnTae Mar 04 '15 at 09:40
1 Answers
4
You might use a file
. Write the object to a file. There is no such thing as an object shared within JVMs because the life cycle of an Object is defined for and within a JVM.
File IO is usually faster than DB operations and simpler as well. But on the downside, ACID
properties are not guaranteed by files and there could be inconsistencies if multiple processes try to read / write on the same file.

TheLostMind
- 35,966
- 12
- 68
- 104
-
1Yes, it could be system pipes for example, using `RandomAccessFile` – Andremoniy Mar 04 '15 at 09:39
-