Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

synchronization between two different JVM

 
Anish Kuti
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how we can synchronize a method in two different JVM?
Actually two manage node runs in two different JVM. But a method should be synchronized.

Is any way out is there .. Please help!!

 
Henry Wong
author
Sheriff
Posts: 22542
109
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anish Kuti wrote:how we can synchronize a method in two different JVM?
Actually two manage node runs in two different JVM. But a method should be synchronized.

Is any way out is there .. Please help!!



Synchronization is at an object level -- and since a particular (the same) instance can't exist in two different JVMs... it won't work.

You need to use some sort of external locking -- it could be any service that is connected to by the two JVMs, even a database will work here. This means that you need to use the API of that service.

On the other hand, you can look into Terracotta (www.terracotta.org). It uses an external service, and bytecode instrumentation, to allow synchronization across JVMs using the standard synchronization mechanism.

Henry
 
kri shan
Ranch Hand
Posts: 1481
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whether java.util.concurrent.locks will help for synchronization between two different JVM ?
 
Anish Kuti
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I doubt java.util.concurrent.locks do help in syncronization between 2 JVM . It will work for a single JVM.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!