mirror of
https://github.com/ACINQ/eclair.git
synced 2025-02-24 06:47:46 +01:00
Fixed concurrency issue in IndexedObservableList
(#961)
Update map with new indexes after element is removed Fixes #915
This commit is contained in:
parent
65918ec0de
commit
9c41ee56b6
1 changed files with 7 additions and 0 deletions
|
@ -52,6 +52,13 @@ class IndexedObservableList[K, V] {
|
|||
val index = map2index.get(key)
|
||||
map2index.remove(key)
|
||||
list.remove(index)
|
||||
// now we need to decrement all higher indices by 1
|
||||
import scala.collection.JavaConversions._
|
||||
for (entry <- map2index.entrySet()) {
|
||||
if (entry.getValue > index) {
|
||||
map2index.put(entry.getKey, entry.getValue - 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue