Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Concurrent Arrays in Java

So, there is a concurrent hashmap in Java, the advantage of which is not to lock down the whole hash table, but only portions of it. I was wondering whether there was such a construction for arrays. Particularly when an array is being resized locking down the whole array is not desirable, especially in real time applications. Anything out there?

like image 240
delmet Avatar asked Jul 25 '11 19:07

delmet


1 Answers

There is AtomicIntegerArray (and the similar AtomicReferenceArray) that may fit your description. But as noted by Marcelo - you can't resize arrays. So you only get concurrent safety without the need to explicitly lock (on) the entire array.

An array ... in which elements may be updated atomically

like image 131
Bozho Avatar answered Oct 29 '22 22:10

Bozho