When a synchronized Java class isn’t thread-safe


Blogs: When a synchronized Java class isn’t thread-safe

  1. Just because you're using the synchronized keyword in your class, doesn't necessarily means its thread safe. This blog entry takes you through the process, so you can ensure thread safety in your classes.
    The moral of the story is that just because a class is fully synchronized, doesn’t mean it’s thread-safe. You still have to be on the look for those sequence of method calls that have to occur atomically, because method level synchronization won’t help in this regard. In other words, watch what you’re doing. Sometimes it’s not so obvious when exactly we’re supposed to synchronize our use of Collections. Ever encountered a ConcurrentModificationException before? I bet it’s probably because your code looks something like this
    Read the complete post: http://rayfd.wordpress.com/2007/11/11/when-a-synchronized-class-isnt-threadsafe/

    Threaded Messages (1)

  2. nice for newbies[ Go to top ]

    What's new in this blog ?