Results 1 to 2 of 2
  1. #1
    JUser is offline Member
    Join Date
    Sep 2010
    Posts
    5
    Rep Power
    0

    Question A collection is not thread-safe?

    Hello

    What is meant by the following text?
    Q. "public synchronized List (only 1 thread can access it at the same time)"

    What does that mean? Does that mean Lists get auto-locked?

    Regards,

  2. #2
    baizba is offline Member
    Join Date
    Sep 2010
    Posts
    4
    Rep Power
    0

    Default

    I guess it means that only one thread at a time can access the synchronized parts of the code for the list implementation you use. But i think that only thread-safe list implementation is Vector. Because i think it is pointless to synchronize on an object which does not have any synchronized methods or synchronized parts of code.

Similar Threads

  1. Singleton Thread safe class
    By userj2ee in forum Advanced Java
    Replies: 1
    Last Post: 08-13-2010, 06:32 PM
  2. Are static methods thread safe?
    By sinisa.medic in forum Threads and Synchronization
    Replies: 6
    Last Post: 06-04-2010, 03:17 PM
  3. Thread safe without using synchronization
    By swetu.vc in forum Threads and Synchronization
    Replies: 3
    Last Post: 01-20-2010, 09:06 AM
  4. The safe way to stop a thread
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-09-2008, 07:31 PM
  5. Struts framework. Is this thread safe?
    By JavaAl2 in forum Web Frameworks
    Replies: 1
    Last Post: 01-17-2008, 04:01 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
  •