Commit 997c86c
committed
Future proof threading / scheduled task flows
This adds a guard to ensure that we only attempt a further scan when we
the scan cycler is started. This helps ensure we've terminated scanning
for the case where all regions have been removed but the service is
still bound. In this case only `stop` will be called (instead of both
`stop` and `destroy`). When this happens there are two potential
scheduled tasks still queued:
- `scanLeDevice(true)` from `deferScanIfNeeded`
- `scheduleScanCycleStop`
Which potential task is queued is based on if we were in an active scan
period or a between scan period when `stop` was called. In the case of a
between scan period the `deferScanIfNeeded` _will_ cause scanning to
start up again when it ends. It will run for one more scan cycle before
it terminates in `finishScanCycle`. Similarly, if we are in an active
scan period the scheduled job for finishing the scan cycle will continue
for the duration of the scan period.1 parent 9d83df6 commit 997c86c
File tree
2 files changed
+4
-2
lines changed- src/main/java/org/altbeacon/beacon/service/scanner
2 files changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
| 233 | + | |
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | | - | |
| 297 | + | |
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
| |||
0 commit comments