Commit 2864d99
Making closed flag in Store and Query volatile (#818)
This way checkOpen() is more accurate in multithreaded scenarios.
Note that putting "synchronized" on checkOpen() would not help much, as the main race is between calling checkOpen() and actually using the handle.
Alternatively, we could lock during the entire time the handle is in use, but this might already be overkill as the current behavior should uncover bad usage patterns already without sacrificing performance and risking new locking issues.
(cherry picked from commit 38be697f774e395359b8717d4991f2fa707bd18c)1 parent fd2119a commit 2864d99
File tree
2 files changed
+4
-2
lines changed- objectbox-java/src/main/java/io/objectbox
- query
2 files changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
| 235 | + | |
| 236 | + | |
236 | 237 | | |
237 | 238 | | |
238 | 239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
| 114 | + | |
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| |||
0 commit comments