2

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?

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
  • 1
    Some 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 Answers1

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