Commit 05f7232
committed
Fix race condition in AbstractDataStoreTest.test_aliveField_volatileVisibility
The test had a timing issue where all reader threads could complete before
the writer thread set alive=false, causing the assertion to fail.
Changes:
- Increased observation iterations from 100 to 1000 for longer read duration
- Added 5ms delay in writer thread before setting alive=false
- Start writer thread before reader threads to ensure proper scheduling
- Writer now sets flag while readers are actively reading
This ensures the volatile field visibility can be properly tested without
timing-dependent failures.1 parent 8a814df commit 05f7232
File tree
1 file changed
+18
-8
lines changed- src/test/java/org/codelibs/fess/ds
1 file changed
+18
-8
lines changedLines changed: 18 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
125 | 139 | | |
126 | 140 | | |
127 | 141 | | |
128 | 142 | | |
129 | 143 | | |
130 | | - | |
| 144 | + | |
131 | 145 | | |
132 | 146 | | |
133 | 147 | | |
| |||
136 | 150 | | |
137 | 151 | | |
138 | 152 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
| 153 | + | |
144 | 154 | | |
145 | 155 | | |
146 | 156 | | |
| |||
155 | 165 | | |
156 | 166 | | |
157 | 167 | | |
158 | | - | |
| 168 | + | |
159 | 169 | | |
160 | 170 | | |
161 | 171 | | |
| |||
0 commit comments