• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Achieving threadsafe behavior for threads coming from two different JVMs

 
Ashutosh Arya
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13077
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic