Results 1 to 2 of 2
- 05-19-2010, 05:20 AM #1
Member
- Join Date
- May 2010
- Posts
- 1
- Rep Power
- 0
Need clear understanding on Synchronization implementation in java
Hi everyone,
i have created one application in java, in which i have used synchronized block. In synchronized block i have written some statements.
so my question is ,when i keep some statements in synchronized block then execution of these statement would be atomic respective to all application threads in Operating system?
or the execution of these statement would be atomic only for application threads what i have created inside application.
- 05-19-2010, 07:45 AM #2
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Your question is vague at best.
Do the other applications on the OS use your code? If not then the question doesn't make sense because the other applications' threads do not compete to run your code anyway.
If however you have multiple applications that share your code and these applications' classes share a classloader then you need to consider what you are synchronizing on. If you synchronize on an object available to all applications e.g a static variable then all applications' threads are affected.
Similar Threads
-
java generics implementation
By sardare in forum Advanced JavaReplies: 1Last Post: 01-14-2010, 01:51 AM -
clear screen prompt using java code
By krunalpatel1410 in forum Advanced JavaReplies: 9Last Post: 04-04-2009, 12:47 AM -
Java Telnet App Implementation
By mgdesmond13 in forum New To JavaReplies: 1Last Post: 07-28-2008, 01:58 AM -
Java Telnet App Implementation
By mgdesmond13 in forum Java AppletsReplies: 0Last Post: 12-26-2007, 03:15 PM -
Clear screen in java
By lenny in forum New To JavaReplies: 1Last Post: 07-30-2007, 09:43 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks