• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JVM concept

 
amarkirt saroay
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have opened 3 console windows,and I run 3 different java programs on them,then is it the scenario of multiple JVM's running simultaneously?
 
Campbell Ritchie
Sheriff
Posts: 48382
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I can tell, yes. But unless you have something like sockets to connect them together, they are probably running independently of one another. If you are attempting simultaneous access to a resource, eg a File, the three processes may interfere with one another.
 
Aniruddh Joshi
Ranch Hand
Posts: 275
Eclipse IDE jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
then synchronization would not help , right ?
 
Campbell Ritchie
Sheriff
Posts: 48382
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know. We haven't got much detail to go on, but synchronization is to protect the contents of an object from what happens outside. This is protecting what happens outside from the contents of an object, so I think you are correct: synchronization wouldn't help.

If the Socket methods are synchronized, that might help. But I don't know that offhand; you will have to look it up.
 
Aniruddh Joshi
Ranch Hand
Posts: 275
Eclipse IDE jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i faced an issue with my quartz scheduler once (here)

the mistake was that i was triggering a new job each 2 minutes and one job took longer than that top execute... i thought these are multiple threads, hence synchronized it .
but as I now understand, it didn't work.
I read this javaranch journal,I made my job stateful and it solved the issue.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Synchronization as it is understood in the Java world only works within a single JVM. If you have multiple JVMs running that are accessing a shared resource (like a file), then they can't help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic