Commit ce9c29a
committed
Fix AndroidSchedulers to create an instance using hook only once.
Previously we were asking the hook for an instance every time `mainThread()` was called. This not only impacted performance, but also broke the contract the that hook was a factory–instead requiring that it behave like a thread-safe, lazily-initialized instance cache.
If for whatever reason you do need to change the instance over time, return a scheduler instance which delegates to another and allows swapping out the delegate.1 parent aeb3ae5 commit ce9c29a
File tree
1 file changed
+13
-9
lines changed- rxandroid/src/main/java/rx/android/schedulers
1 file changed
+13
-9
lines changedLines changed: 13 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
22 | 27 | | |
23 | | - | |
24 | | - | |
| 28 | + | |
25 | 29 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
30 | 36 | | |
31 | 37 | | |
32 | 38 | | |
33 | 39 | | |
34 | | - | |
35 | | - | |
36 | | - | |
| 40 | + | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
| |||
0 commit comments