Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Synchronization on object

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Synchronization on object

    Respected PROGRAMMERS,
    when a synchronized block is used for synchronization on an object instance, then threads compete to get into object's implicit monitor. And once, any particular thread enters into the monitor, any other thread has to wait for entering into it.
    Then



    synchronized(object){
    // some code here
    // no function call
    }


    must not enforce taking any particular type of object.
    Thus any object type can be used here because every object has its implicit monitor.

    Kindly reply me is it true?


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Synchronization on object

    Yes, every object has its own monitor. Read the API doc for the methods of the Object class.

Similar Threads

  1. Synchronization of ServletContext Object
    By jkoder70014 in forum Java Servlet
    Replies: 2
    Last Post: August 23rd, 2011, 10:58 AM
  2. Reading from ResultSet to Object and from object Object Array
    By anmaston in forum What's Wrong With My Code?
    Replies: 4
    Last Post: April 7th, 2011, 06:11 AM
  3. synchronization problems
    By stroodlepup in forum Threads
    Replies: 2
    Last Post: February 28th, 2011, 09:26 AM
  4. Database synchronization from RMS with MySQL in Online mode
    By jeremyraj in forum Java ME (Mobile Edition)
    Replies: 1
    Last Post: January 24th, 2011, 08:08 AM
  5. synchronization
    By bbr201 in forum Java Theory & Questions
    Replies: 6
    Last Post: August 29th, 2010, 09:32 AM