Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

synchronized code in the cluster server

 
anil bisht
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
If i synchronize a code will it work in the cluster servers.
I have two cluster server. Here i have the generating a unique file name. I check in a directory, and if the file name is present i generate a unique fine name by appending the time stamp. So this code has to be synchronized.
Now my both the servers are mapped to a sinple directory. Will my synchronized code run??. as now both the server executes its own code independendtly, will the synchronized code be synchronized or both the servers will run it own code.

TIA
Anil
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Synchronization doesn't work between different JVMs, only between threads in the same JVM.
Does that answer your question?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic