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

    Question A collection is not thread-safe?


    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?


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


    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, 05:32 PM
  2. Are static methods thread safe?
    By sinisa.medic in forum Threads and Synchronization
    Replies: 6
    Last Post: 06-04-2010, 02:17 PM
  3. Thread safe without using synchronization
    By 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, 06: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