[英]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. 我只是通读了java.util.concurrent包的API文档 。
My impression is that " concurrent " and " thread-safe " are used synonymously there. 我的印象是,“ 并发 ”和“ 线程安全 ”在那里被同义词使用。
Example: 例:
ConcurrentLinkedDeque - An unbounded concurrent deque based on linked nodes.
ConcurrentLinkedDeque-基于链接节点的无限制并发双端队列。 ConcurrentLinkedQueue - An unbounded thread-safe queue based on linked nodes.
ConcurrentLinkedQueue-基于链接节点的无界线程安全队列。
In the scope of the concurrency package can I assume that the wording thread-safe and concurrent mean the same thing? 在并发包的范围内,我可以假设线程安全和并发这两个词是同一回事吗?
Yes ... everything in the concurrent package can be used concurrently from different threads; 是的...并发包中的所有内容都可以从不同线程并发使用; eg 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. 除此之外……
java.util.concurrent.*
包的全部目的是为并发(多线程)编程提供工具。
See: Oracle's Java tutorials; 请参阅: Oracle的Java教程; Concurrency
并发
我认为在这种情况下,它的意思是“一个线程安全的集合,它是非阻塞的(与其他使用同步的Stack等其他旧集合不同,它更适合于并发访问”)。
I've looked at the ConcurrentLinkedQueue
documentation, and it says: 我看了
ConcurrentLinkedQueue
文档,它说:
[...] As with other concurrent collections [...]
[...]与其他并发集合[...]
it also says: 它还说:
[...] An unbounded thread-safe queue based on linked nodes.
[...]基于链接节点的无界线程安全队列。
Because it says that a CLQ is thread-safe, and it compares it to "other concurrent collections," I think we can assume that they are, in fact, used synonymously. 因为它说CLQ是线程安全的,并且将它与“其他并发集合”进行比较,所以我认为我们可以假定它们实际上是同义词。
The only real way to find out is by inspecting the source of your Java distribution. 找出问题的唯一真正方法是检查Java发行版的来源。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.