Results 1 to 2 of 2
  1. #1
    pankajsatwal is offline Member
    Join Date
    May 2010
    Posts
    1
    Rep Power
    0

    Default 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.

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    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

  1. java generics implementation
    By sardare in forum Advanced Java
    Replies: 1
    Last Post: 01-14-2010, 02:51 AM
  2. clear screen prompt using java code
    By krunalpatel1410 in forum Advanced Java
    Replies: 9
    Last Post: 04-04-2009, 01:47 AM
  3. Java Telnet App Implementation
    By mgdesmond13 in forum New To Java
    Replies: 1
    Last Post: 07-28-2008, 02:58 AM
  4. Java Telnet App Implementation
    By mgdesmond13 in forum Java Applets
    Replies: 0
    Last Post: 12-26-2007, 04:15 PM
  5. Clear screen in java
    By lenny in forum New To Java
    Replies: 1
    Last Post: 07-30-2007, 10:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •