Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa2501b0 authored by Evan Laird's avatar Evan Laird
Browse files

[mobile] wrap the get-or-create block in a `synchronized`

The bug: while the subIdRepositoryCache is using ConcurrentHashMap, the
`get` (which returns null the first time) does not synchronize with the
call to `createRepositoryForSubId`. This means that if multiple getters
happen at the same time, we can end up creating multiple repositories.

The fix: synchronize both functions around the map.

Test: MobileConnectionsRepositoryTest
Test: manually logging creations of the mobile connection repositories
Bug: 405396564
Flag: EXEMPT bugfix
Change-Id: Ibcb6d0aa9b2732d175280910326cfea181001d83
parent fac5dcbe
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment