mirror of
https://github.com/corda/corda.git
synced 2024-12-29 09:18:58 +00:00
Classloader loading DataSource must stay open [ENT-1717] (#709)
This commit is contained in:
parent
f022c67689
commit
2fc7e5e674
@ -58,7 +58,7 @@ object DataSourceFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun createDatasourceFromDriverJarFolders(dataSourceProperties: Properties, baseClassLoader: ClassLoader, driverJarsPath: List<Path>): DataSource {
|
fun createDatasourceFromDriverJarFolders(dataSourceProperties: Properties, baseClassLoader: ClassLoader, driverJarsPath: List<Path>): DataSource {
|
||||||
return URLClassLoader(driverJarsPath.flatMap { Files.newDirectoryStream(it, "*.jar") }.map { it.toUri().toURL() }.toTypedArray(), baseClassLoader).use { driversClassLoader ->
|
return URLClassLoader(driverJarsPath.flatMap { Files.newDirectoryStream(it, "*.jar") }.map { it.toUri().toURL() }.toTypedArray(), baseClassLoader).let { driversClassLoader ->
|
||||||
val dataSourceClassName = dataSourceProperties["dataSourceClassName"] as String?
|
val dataSourceClassName = dataSourceProperties["dataSourceClassName"] as String?
|
||||||
val dataSourceClass = driversClassLoader.loadClass(dataSourceClassName)
|
val dataSourceClass = driversClassLoader.loadClass(dataSourceClassName)
|
||||||
val dataSourceInstance = dataSourceClass.newInstance() as DataSource
|
val dataSourceInstance = dataSourceClass.newInstance() as DataSource
|
||||||
|
Loading…
Reference in New Issue
Block a user