Commit e16599e
Avoid calling ServiceLoader twice with same class loader (#5948)
* Avoid calling ServiceLoader twice with same class loader (#5903)
* Avoid calling ServiceLoader twice with same class loader
The ServiceLoader goes through all the jars to find its files and it
seems like a good idea to avoid doing it twice for the same class
loader.
This is somehow related to the work we are doing in Quarkus for Leyden.
* Simplify io.vertx.core.impl.ServiceHelper.loadFactories(java.lang.Class<T>, java.lang.ClassLoader)
For readability
Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
* Skip reloading factories if TCCL happens to be the same as the ServiceHelper's CL
Saves the cost of scanning the classpath again
Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
* Verify we don't try to get resource from CL twice when the TCCL is the same as the ServiceHelper's classloader
Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
---------
Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
Co-authored-by: Thomas Segismont <tsegismont@gmail.com>
* Fix test ServiceCommandLoaderTest.testNoCommandsWhenLoadedFromEmptyClassloader
Bug was previously hidden by an incorrect test...
Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
---------
Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
Co-authored-by: Guillaume Smet <guillaume.smet@gmail.com>1 parent e700702 commit e16599e
3 files changed
Lines changed: 63 additions & 20 deletions
File tree
- src
- main/java/io/vertx/core
- test/java/io/vertx/core
- impl/launcher
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
| |||
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
48 | | - | |
49 | | - | |
50 | 51 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
56 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
57 | 67 | | |
58 | 68 | | |
59 | 69 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | 70 | | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
26 | 29 | | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
128 | 132 | | |
129 | 133 | | |
130 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
131 | 174 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
0 commit comments