aspose file tools*
The moose likes Java in General and the fly likes Achieving threadsafe behavior for threads coming from two different JVMs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Achieving threadsafe behavior for threads coming from two different JVMs" Watch "Achieving threadsafe behavior for threads coming from two different JVMs" New topic
Author

Achieving threadsafe behavior for threads coming from two different JVMs

Ashutosh Arya
Ranch Hand

Joined: Oct 07, 2008
Posts: 69
Hi,

Is there a way to make a block of code threadsafe so that even if the requests are coming from two different JVMs altogether (where the EARs are deployed having the same code) they do not access the code in parallel?

Thanks in advance,
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Separate JVMs would of course have separate object instances and separate Threads so this gets tricky. Probably some outside entity will have to be involved, say a database or a file representing a "token" which both JVMs can see.

Exactly what is the problem you are trying to solve?

Bill
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Achieving threadsafe behavior for threads coming from two different JVMs