Commit 16c9f6c
committed
fix concurrency with modifying log listeners
Avoid ConcurrentModificationException when someone adds or removes a
log listener while the stack is still inside the onLogEvent method.
Addressed by switching from an ArrayList to CopyOnWriteArrayList.
This is a good fit as the listener list will rarely be modified, but
will have a ton of reads.
Added test to prove and ensure this issue is now avoided.1 parent b281457 commit 16c9f6c
File tree
3 files changed
+49
-1
lines changed- OneSignalSDK
- onesignal/src/main/java/com/onesignal
- unittest/src/test/java/com
- onesignal
- test/onesignal
3 files changed
+49
-1
lines changedLines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| |||
1348 | 1349 | | |
1349 | 1350 | | |
1350 | 1351 | | |
1351 | | - | |
| 1352 | + | |
1352 | 1353 | | |
1353 | 1354 | | |
1354 | 1355 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
331 | 335 | | |
332 | 336 | | |
333 | 337 | | |
| |||
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
| |||
133 | 135 | | |
134 | 136 | | |
135 | 137 | | |
| 138 | + | |
136 | 139 | | |
137 | 140 | | |
138 | 141 | | |
| |||
4167 | 4170 | | |
4168 | 4171 | | |
4169 | 4172 | | |
| 4173 | + | |
| 4174 | + | |
| 4175 | + | |
| 4176 | + | |
| 4177 | + | |
| 4178 | + | |
| 4179 | + | |
| 4180 | + | |
| 4181 | + | |
| 4182 | + | |
| 4183 | + | |
| 4184 | + | |
| 4185 | + | |
| 4186 | + | |
| 4187 | + | |
| 4188 | + | |
| 4189 | + | |
| 4190 | + | |
| 4191 | + | |
| 4192 | + | |
| 4193 | + | |
| 4194 | + | |
| 4195 | + | |
| 4196 | + | |
| 4197 | + | |
| 4198 | + | |
| 4199 | + | |
| 4200 | + | |
| 4201 | + | |
| 4202 | + | |
| 4203 | + | |
| 4204 | + | |
| 4205 | + | |
| 4206 | + | |
| 4207 | + | |
| 4208 | + | |
| 4209 | + | |
| 4210 | + | |
| 4211 | + | |
| 4212 | + | |
4170 | 4213 | | |
4171 | 4214 | | |
4172 | 4215 | | |
| |||
0 commit comments