Himanshu Singh
Himanshu Singh

Reputation: 45

Updating Array elements with out blocking entire array

Which Java Concurrent collection provide Array element level locking or atomic updation of Array elements. I do not want to lock entire array. there is 99% read operations and only 1% write operations only.

Locking while writing in array will block may other threads which even might not be looking at the same element which is being updated by blocking thread.

Upvotes: 1

Views: 117

Answers (1)

assylias
assylias

Reputation: 328598

You can use an AtomicXxxArray where each element can be atomically updated with appropriate visibility guarantees:

Upvotes: 3

Related Questions