Commit e41db81
authored
[ES-1436915] Pass context to public classes and their dependencies (#806)
For public classes and interfaces, we can't make assumptions about the threading environment in which they will be used. Specifically, host applications may utilize these classes, such as ResultSet, in a thread that is different from the one that created the JDBC connection resource.
In the current implementation of certain APIs, along with the execution flow of DatabricksResultSet, there is an expectation that the thread will automatically be populated with an internal context object. This assumption is problematic, given the scenario described above, where threads may not have the expected context object set by default.
To address this issue, this pull request explicitly passes the context object to the areas where it was previously missing, correcting the faulty implementation.
Key changes in this PR:
- The metadata result set builder class has been refactored from a static utility class to an instance-based class, with the context object now stored as a member variable.
- The context object is now passed explicitly to the DatabricksResultSet class, ensuring that it functions correctly in multithreaded environments.
These changes eliminate the previous assumption about the thread's context1 parent 2fba0bb commit e41db81
File tree
14 files changed
+281
-179
lines changed- src
- main/java/com/databricks/jdbc
- api/impl
- common/util
- dbclient/impl
- common
- sqlexec
- thrift
- test/java/com/databricks/jdbc
- api/impl
- common/util
- dbclient/impl
- common
- sqlexec
14 files changed
+281
-179
lines changedLines changed: 15 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
944 | 945 | | |
945 | 946 | | |
946 | 947 | | |
947 | | - | |
| 948 | + | |
948 | 949 | | |
949 | 950 | | |
950 | 951 | | |
| |||
969 | 970 | | |
970 | 971 | | |
971 | 972 | | |
972 | | - | |
| 973 | + | |
973 | 974 | | |
974 | 975 | | |
975 | 976 | | |
| |||
1011 | 1012 | | |
1012 | 1013 | | |
1013 | 1014 | | |
1014 | | - | |
| 1015 | + | |
1015 | 1016 | | |
1016 | 1017 | | |
1017 | 1018 | | |
| |||
1026 | 1027 | | |
1027 | 1028 | | |
1028 | 1029 | | |
1029 | | - | |
| 1030 | + | |
1030 | 1031 | | |
1031 | 1032 | | |
1032 | 1033 | | |
| |||
1045 | 1046 | | |
1046 | 1047 | | |
1047 | 1048 | | |
1048 | | - | |
| 1049 | + | |
1049 | 1050 | | |
1050 | 1051 | | |
1051 | 1052 | | |
| |||
1064 | 1065 | | |
1065 | 1066 | | |
1066 | 1067 | | |
1067 | | - | |
| 1068 | + | |
1068 | 1069 | | |
1069 | 1070 | | |
1070 | 1071 | | |
| |||
1155 | 1156 | | |
1156 | 1157 | | |
1157 | 1158 | | |
1158 | | - | |
| 1159 | + | |
1159 | 1160 | | |
1160 | 1161 | | |
1161 | 1162 | | |
| |||
1333 | 1334 | | |
1334 | 1335 | | |
1335 | 1336 | | |
1336 | | - | |
| 1337 | + | |
1337 | 1338 | | |
1338 | 1339 | | |
1339 | 1340 | | |
| |||
1346 | 1347 | | |
1347 | 1348 | | |
1348 | 1349 | | |
1349 | | - | |
| 1350 | + | |
1350 | 1351 | | |
1351 | 1352 | | |
1352 | 1353 | | |
| |||
1361 | 1362 | | |
1362 | 1363 | | |
1363 | 1364 | | |
1364 | | - | |
| 1365 | + | |
1365 | 1366 | | |
1366 | 1367 | | |
1367 | 1368 | | |
| |||
1478 | 1479 | | |
1479 | 1480 | | |
1480 | 1481 | | |
1481 | | - | |
| 1482 | + | |
1482 | 1483 | | |
1483 | 1484 | | |
1484 | 1485 | | |
| |||
1492 | 1493 | | |
1493 | 1494 | | |
1494 | 1495 | | |
1495 | | - | |
| 1496 | + | |
1496 | 1497 | | |
1497 | 1498 | | |
1498 | 1499 | | |
| |||
1509 | 1510 | | |
1510 | 1511 | | |
1511 | 1512 | | |
1512 | | - | |
| 1513 | + | |
1513 | 1514 | | |
1514 | 1515 | | |
1515 | 1516 | | |
| |||
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
93 | 96 | | |
94 | 97 | | |
95 | 98 | | |
| |||
156 | 159 | | |
157 | 160 | | |
158 | 161 | | |
159 | | - | |
| 162 | + | |
| 163 | + | |
160 | 164 | | |
161 | 165 | | |
162 | 166 | | |
| |||
Lines changed: 15 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | 13 | | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
57 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
58 | 64 | | |
59 | 65 | | |
60 | 66 | | |
| 67 | + | |
61 | 68 | | |
62 | 69 | | |
63 | 70 | | |
| |||
99 | 106 | | |
100 | 107 | | |
101 | 108 | | |
102 | | - | |
| 109 | + | |
103 | 110 | | |
104 | 111 | | |
105 | 112 | | |
| |||
137 | 144 | | |
138 | 145 | | |
139 | 146 | | |
140 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
141 | 150 | | |
142 | 151 | | |
143 | 152 | | |
| |||
519 | 528 | | |
520 | 529 | | |
521 | 530 | | |
522 | | - | |
| 531 | + | |
523 | 532 | | |
524 | 533 | | |
525 | 534 | | |
| |||
528 | 537 | | |
529 | 538 | | |
530 | 539 | | |
531 | | - | |
| 540 | + | |
532 | 541 | | |
533 | 542 | | |
534 | 543 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
262 | | - | |
| 262 | + | |
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
| 201 | + | |
202 | 202 | | |
203 | | - | |
204 | 203 | | |
205 | 204 | | |
206 | 205 | | |
| |||
0 commit comments