Commit 0f5e823
committed
Add thread annotations for
Through testing it's been confirmed that the bluetooth scan callbacks
are always run on the main thread. This chases that through the scanners
and our callbacks so that this is properly documented / annotated.
During this process the unused `AsyncTask` methods were removed as we
don not use them. Additionally, the `mDistinctPacketsDetectedPerScan`
flag has been declared `volatile` to ensure reads always see the most
recently written value without having to rely on a heavy weight
`synchronized` block. As this is a flag we only perform simple reads /
writes. While we do perform a multi-step operation around
reading/writing this value the work performed is too heavy weight and
long to wrap it in a `synchronized` block. Using `volatile` gives
multipel concurrent background threads a better chance of aborting this
logic if another has changed the value. However, the downside of not
having complete synchronization is that a background thread will try to
check a few more packets and then re-set the flag to `true`.CycledLeScanCallback
1 parent 0ab8bee commit 0f5e823
5 files changed
Lines changed: 54 additions & 18 deletions
File tree
- src/main/java/org/altbeacon/beacon/service
- scanner
Lines changed: 19 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
391 | 392 | | |
392 | 393 | | |
393 | 394 | | |
| 395 | + | |
394 | 396 | | |
395 | 397 | | |
396 | 398 | | |
| |||
405 | 407 | | |
406 | 408 | | |
407 | 409 | | |
| 410 | + | |
408 | 411 | | |
409 | 412 | | |
410 | 413 | | |
| |||
418 | 421 | | |
419 | 422 | | |
420 | 423 | | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
421 | 427 | | |
422 | 428 | | |
423 | 429 | | |
| |||
430 | 436 | | |
431 | 437 | | |
432 | 438 | | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
433 | 442 | | |
434 | 443 | | |
435 | 444 | | |
| |||
452 | 461 | | |
453 | 462 | | |
454 | 463 | | |
455 | | - | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
456 | 473 | | |
457 | 474 | | |
458 | 475 | | |
| |||
520 | 537 | | |
521 | 538 | | |
522 | 539 | | |
| 540 | + | |
523 | 541 | | |
524 | 542 | | |
525 | 543 | | |
| |||
554 | 572 | | |
555 | 573 | | |
556 | 574 | | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | 575 | | |
570 | 576 | | |
571 | 577 | | |
| |||
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
6 | 12 | | |
7 | 13 | | |
| 14 | + | |
8 | 15 | | |
9 | | - | |
10 | | - | |
| 16 | + | |
| 17 | + | |
11 | 18 | | |
Lines changed: 21 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
78 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
79 | 96 | | |
80 | 97 | | |
81 | 98 | | |
| |||
188 | 205 | | |
189 | 206 | | |
190 | 207 | | |
| 208 | + | |
191 | 209 | | |
192 | 210 | | |
193 | 211 | | |
194 | 212 | | |
| 213 | + | |
195 | 214 | | |
196 | 215 | | |
197 | 216 | | |
| |||
334 | 353 | | |
335 | 354 | | |
336 | 355 | | |
337 | | - | |
| 356 | + | |
338 | 357 | | |
339 | 358 | | |
340 | 359 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
283 | | - | |
| 283 | + | |
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| 302 | + | |
302 | 303 | | |
303 | 304 | | |
304 | 305 | | |
| |||
311 | 312 | | |
312 | 313 | | |
313 | 314 | | |
| 315 | + | |
314 | 316 | | |
315 | 317 | | |
316 | 318 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
0 commit comments