Trove 库是线程安全的吗?
GNU trove 库是线程安全的吗?我对 TObjectDoubleHashMap 特别感兴趣。我查看了他们的文档,但它没有提到任何内容,所以我们应该假设它不是线程安全的吗?
Is the GNU trove library thread-safe? I am particularly interested in TObjectDoubleHashMap. I looked at their documentation, but it hasn't mentioned anything, so shall we assume it is not thread-safe?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它具有使其线程安全的实用程序。看:
http://trove4j.sourceforge.net/javadocs/gnu/trove/TCollections.html
此外,由于集合主要由原始数组支持,因此您(通常)可以安全地跨多个线程执行读取操作(迭代/获取)。
It has utilities to make it thread safe. See:
http://trove4j.sourceforge.net/javadocs/gnu/trove/TCollections.html
Also, since the collections are mostly backed by primitive arrays, you can (usually) safely perform read operations (iteration/get) across multiple threads.
它不是线程安全的。您可以使用synchronized或您自己的Lock来使其线程安全。
Its not thread safe. You can use synchronized or your own Lock to make it thread safe.