collection « Thread Safe « Java Thread Q&A

Home
Java Thread Q&A
1.concurrency
2.Development
3.Exception
4.Notify
5.Operation
6.Socket
7.State
8.synchronize
9.Thread Safe
10.ThreadPool
Java Thread Q&A » Thread Safe » collection 

1. Does the unmodifiable wrapper for java collections make them thread safe?    stackoverflow.com

I need to make an ArrayList of ArrayLists thread safe. I also cannot have the client making changes to the collection. Will the unmodifiable wrapper make it thread safe or do ...

2. Java object implements Runnable, how to remove the object from a collection    stackoverflow.com

I have a java object that implements Runnable. here is the code.

public class Obj implements Runnable {

    boolean shouldRun;

    private int stuff

    ...

3. If all collection attributes are thread-safe , can we say that this collection is thread-safe?    stackoverflow.com

If all attributes (or items fields, or data members) of a java collection are thread-safe (CopyOnWriteArraySet,ConcurrentHashMap, BlockingQueue, ...), can we say that this collection is thread-safe ? an exemple :

public class AmIThreadSafe ...

4. In Java, is a Comparator used in Collections.sort() thread safe?    stackoverflow.com

If I create a single instance of a Comparator, can that instance be used across multiple threads to sort collections using Collections.sort()? Or, do I need to create a new ...

5. Thread-safe HashSet with Guava Collections    stackoverflow.com

Like the title says, i would like to get a thread-safe HashSet using Guava Collections. Can you help me? Thanks!

6. Are chained thread safe collections thread safe?    stackoverflow.com

If I have the following declaration:

Map<String, Map<String, Person>> families = 
   Collections.synchronizedMap(new HashMap<String, Map<String, Person>>());
If I then chain a call like so:
families.get(lastName).put(firstName, new Person());
Is this thread safe? To ...

7. In Java, there is a collection which I can take an element only after a time?    stackoverflow.com

I'm doing an webcrawler, and I want to not overload the servers with requests, so I will limit the access to the servers by time. I will have an object/collection that is ...

8. Threadsafe iteration over non-indexed collection?    coderanch.com

Hello, Does a way exist for multiple threads to iterate over the same collection without interfering with one another and without using indexes or toArray()? As I understand it, each collection object only has one instance of an iterator, so two threads can't use it to independently iterate through the collection. Thank you, Yuriy

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.