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?
SCJP-75%
SCWCD-82%
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32667
4
posted
0
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.
Anrd
"One of the best things you could do is to simplify a larger application into a smaller one by reducing its process and complexity - Fowler"
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32667
4
posted
0
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.
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
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
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.