Is the Trove library thread-safe?
Asked Answered
H

2

13

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?

Hyperthermia answered 24/10, 2011 at 11:18 Comment(0)
T
9

Its not thread safe. You can use synchronized or your own Lock to make it thread safe.

Typical answered 24/10, 2011 at 11:21 Comment(0)
M
12

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.

Merilynmeringue answered 13/3, 2014 at 16:47 Comment(1)
I realize now that Peter's answer was correct at the time it was given- I linked to newer APIs.Merilynmeringue
T
9

Its not thread safe. You can use synchronized or your own Lock to make it thread safe.

Typical answered 24/10, 2011 at 11:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.