Commit 68aaba8
authored
[PECO-2009] Improvements to thrift-server client (#552)
apache http client maintains a pool of connections to mitigate TCP-handshake for every request. however, server can unilaterally decide to close the connection to avoid resource drainage. a problem with classical network IO model (used by apache client 4.x) is that the socket only reacts to incoming events when it is blocked on an operation. the client, therefore can miss the event of server closing the connection. this creates a need to remove expired/idle connections from the pool on client side.
there are broadly two ways of doing so:
close such connections manually in different code paths (currently being done using the method)
create a background thread. from apache http client 4.5 onwards, they have included [IdleConnectionEvictor](https://www.javadoc.io/doc/org.apache.httpcomponents/httpclient/4.5.5/org/apache/http/impl/client/IdleConnectionEvictor.html) in library so that users don't have to write code for the background thread. we can use this to avoid manually calling the method
summarising the improvements:
- use byte array input stream for receiving data structure
- use IdleConnectionEvictor to close expired/idle connections1 parent 385cb64 commit 68aaba8
File tree
8 files changed
+167
-334
lines changed- src
- main/java/com/databricks/jdbc
- api/impl/arrow
- dbclient
- impl
- http
- thrift
- test/java/com/databricks/jdbc/dbclient/impl
- http
- thrift
8 files changed
+167
-334
lines changedLines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
135 | 134 | | |
136 | 135 | | |
137 | 136 | | |
| |||
188 | 187 | | |
189 | 188 | | |
190 | 189 | | |
191 | | - | |
192 | 190 | | |
193 | 191 | | |
194 | 192 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | 17 | | |
Lines changed: 8 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
55 | | - | |
56 | 56 | | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
61 | | - | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| |||
219 | 222 | | |
220 | 223 | | |
221 | 224 | | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | 225 | | |
247 | 226 | | |
248 | 227 | | |
| |||
270 | 249 | | |
271 | 250 | | |
272 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
273 | 255 | | |
274 | 256 | | |
275 | 257 | | |
| |||
Lines changed: 57 additions & 81 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | | - | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| 28 | + | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | | - | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 55 | + | |
97 | 56 | | |
98 | 57 | | |
99 | 58 | | |
100 | | - | |
101 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
102 | 62 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
112 | 67 | | |
| 68 | + | |
113 | 69 | | |
114 | 70 | | |
115 | 71 | | |
| |||
119 | 75 | | |
120 | 76 | | |
121 | 77 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
130 | 90 | | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
144 | 99 | | |
145 | | - | |
| 100 | + | |
146 | 101 | | |
147 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
148 | 106 | | |
149 | 107 | | |
150 | 108 | | |
| |||
158 | 116 | | |
159 | 117 | | |
160 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
161 | 127 | | |
162 | 128 | | |
163 | 129 | | |
164 | 130 | | |
165 | 131 | | |
166 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
167 | 143 | | |
0 commit comments