Commit 96c8414
committed
Automatically initialize
Motivation:
The `initialize()` method of `AbstractEndpointSelector` may access
member fields of subclasses, `initialize()` couldn't be called in the
constructor of `AbstractEndpointSelector`.
Although the requirement is stated in the Javadoc, many users overlooked
calling `initialize()` in their implementations.
I propose adding a fallback logic that automatically initializes
`AbstractEndpointSelector` if it hasn't been intialized by the time the
first enpoint selection occurs, so users are protected from
implmentation mistakes.
Modifications:
- Try to initialize `AbstractEndpointSelector` if it hasn't been
initialized when `select(...)` method is called.
Result:
Make `AbstractEndpointSelector` auto-initialize to avoid user-side
implementation errors.AbstractEndpointSelector
1 parent 9194843 commit 96c8414
File tree
5 files changed
+34
-8
lines changed- core/src
- main/java/com/linecorp/armeria/client/endpoint
- test/java/com/linecorp/armeria/client
- endpoint
- xds/src/main/java/com/linecorp/armeria/xds/client/endpoint
5 files changed
+34
-8
lines changedLines changed: 27 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
41 | 45 | | |
42 | 46 | | |
| 47 | + | |
| 48 | + | |
43 | 49 | | |
44 | 50 | | |
45 | 51 | | |
| |||
59 | 65 | | |
60 | 66 | | |
61 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
62 | 71 | | |
63 | | - | |
64 | 72 | | |
65 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
66 | 89 | | |
67 | 90 | | |
68 | 91 | | |
69 | 92 | | |
70 | 93 | | |
| 94 | + | |
71 | 95 | | |
72 | 96 | | |
73 | 97 | | |
| |||
106 | 130 | | |
107 | 131 | | |
108 | 132 | | |
| 133 | + | |
109 | 134 | | |
110 | 135 | | |
111 | 136 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | 92 | | |
94 | 93 | | |
95 | 94 | | |
| |||
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
| 52 | + | |
| 53 | + | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| |||
56 | 59 | | |
57 | 60 | | |
58 | 61 | | |
| 62 | + | |
59 | 63 | | |
60 | 64 | | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | 68 | | |
63 | 69 | | |
| |||
128 | 134 | | |
129 | 135 | | |
130 | 136 | | |
131 | | - | |
| 137 | + | |
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
| |||
137 | 143 | | |
138 | 144 | | |
139 | 145 | | |
140 | | - | |
141 | | - | |
142 | 146 | | |
143 | 147 | | |
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
253 | 252 | | |
254 | 253 | | |
255 | 254 | | |
| |||
0 commit comments