concurrency in Java

Posted by p1 on Stack Overflow See other posts from Stack Overflow or by p1
Published on 2010-05-13T03:14:35Z Indexed on 2010/05/13 3:24 UTC
Read the original article Hit count: 342

Filed under:
|

1]What is Non-blocking Concurrency and how is it different.

2] I have heard that this is available in Java. Are there any particular scenarios we should use this feature

3] Is there a difference/advantage of using one of these methods for a collection. What are the trade offs

class List   
{  
    private final ArrayList<String> list = new ArrayList<String>();

    void add(String newValue) 
    {
        synchronized (list)
        {
            list.add(newValue);
        }
    }
}  

OR

private final ArrayList<String> list = Collections.synchronizedMap();  

The questions are more from a learning/understanding point of view. Thanks for attention.

© Stack Overflow or respective owner

Related posts about java

Related posts about concurrency