Skip to content

Commit ac251a6

Browse files
committed
Document why loadDriversInTCCL is necessary
1 parent 36c7c66 commit ac251a6

File tree

1 file changed

+7
-1
lines changed
  • extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime

1 file changed

+7
-1
lines changed

extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSources.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,13 @@ public boolean isValid(Connection connection) {
367367

368368
/**
369369
* Uses the {@link ServiceLoader#load(Class) ServiceLoader to load the JDBC drivers} in context
370-
* of the current {@link Thread#getContextClassLoader() TCCL}
370+
* of the current {@link Thread#getContextClassLoader() TCCL}.
371+
* <p>
372+
* This is necessary to have JDBC URLs work properly, in particular when using custom drivers,
373+
* and in particular when the app gets "restarted" in a single system (?) classloader,
374+
* because DriverManager's list of available drivers would get cleared on shutdown.
375+
* <p>
376+
* See also https://github.com/quarkusio/quarkus/issues/46324#issuecomment-2687615191
371377
*/
372378
private static void loadDriversInTCCL() {
373379
// load JDBC drivers in the current TCCL

0 commit comments

Comments
 (0)