Commit bb3863b
committed
Improve thread-safety of VssStoreIdProvider
Changes:
- Remove @volatile annotation (redundant with synchronized blocks)
- Change cachedStoreIds from var to val (map reference never changes)
- Move cache check inside synchronized block for proper thread-safety
- MutableMap operations must be synchronized; @volatile only affects reference visibility
This ensures all map operations happen under synchronization, preventing
potential race conditions when multiple threads access the cache.1 parent fcb94b9 commit bb3863b
File tree
1 file changed
+3
-6
lines changed- app/src/main/java/to/bitkit/data/backup
1 file changed
+3
-6
lines changedLines changed: 3 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
| 15 | + | |
17 | 16 | | |
18 | 17 | | |
19 | | - | |
20 | | - | |
21 | | - | |
| 18 | + | |
22 | 19 | | |
23 | 20 | | |
24 | 21 | | |
| |||
32 | 29 | | |
33 | 30 | | |
34 | 31 | | |
35 | | - | |
| 32 | + | |
36 | 33 | | |
37 | 34 | | |
38 | 35 | | |
| |||
0 commit comments