Search code examples
javajava-7java.util.concurrent

What is the difference of "concurrent" and "thread-safe" in Java 7 API documentation?


I just read through the API documentation of the java.util.concurrent package.

My impression is that "concurrent" and "thread-safe" are used synonymously there.

Example:

ConcurrentLinkedDeque - An unbounded concurrent deque based on linked nodes. ConcurrentLinkedQueue - An unbounded thread-safe queue based on linked nodes.

In the scope of the concurrency package can I assume that the wording thread-safe and concurrent mean the same thing?


Solution

  • Yes ... everything in the concurrent package can be used concurrently from different threads; e.g. thread-safe.

    Specifically on the page you link to, under the "Concurrent Collections" section:

    A concurrent collection is thread-safe, but not governed by a single exclusion lock.

    Aside from that ... the entire purpose of the java.util.concurrent.* packages is to provide tools for concurrent (multi-threaded) programming.

    See: Oracle's Java tutorials; Concurrency