• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Sysnchronization on multiple JVMs

 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

How synchronization can be handled by multiple JVMs?

Making the method/block synchorized will not work in case multiple JVMs. So how to go about it.

Thanks,
Grishma
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
https://coderanch.com/t/233295/threads/java/Synchronization-across-diff-JVM

Hope it helps!!
 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Terracotta - http://www.terracotta.org/

That's a very cool product which does exactly what you are asking about.
 
Master Rancher
Posts: 4062
56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm... the comment in that thread about "Multiple processors are superset of multiple JVMs" was false in 2006, and it's false now. Ignore it. A single JVM may span multiple processors, or a single processor may run multiple JVMs. But the other points look good. A database with transactions or locking is quite possibly the way to go. Alternately you might look at the Actor model, supported by other languages such as Erlang or Scala (which runs on the JVM), or by some Java libraries such as Functional Java or Kilim.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You know how many JVMs on which your application is deployed. Say you have 4 JVMS
This is how you can divide your work among multiple JVMs.
1. Java program running in each JVM will generate a random no say 51, 40, 33, 42 (4 JVMs so 4 random nos).
2. Each program will enter his random no in DB and wait till all four enters there random no.
3. After all the four random nos are entered in DB the program running on JVM with the least no (33 i.e. JVM 3) will become master and will divide the work and update the DB with the division of work (division of work mean which JVM will process which set of data).
4. Once the master JVM enters the plan All JVM can follow the plan.

Please let me know if this solution fits your problem.

Sandeep Hooda.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic