mirror of
https://github.com/corda/corda.git
synced 2024-12-21 22:07:55 +00:00
Close classloader to release associated file (#2635)
[CORDA-1113] Close classloader to release associated file
This commit is contained in:
parent
7517270dde
commit
cc84b34dca
@ -26,6 +26,7 @@ fun scanJarForContracts(cordappJarPath: String): List<ContractClassName> {
|
|||||||
// Only keep instantiable contracts
|
// Only keep instantiable contracts
|
||||||
val classLoader = URLClassLoader(arrayOf(File(cordappJarPath).toURL()), currentClassLoader)
|
val classLoader = URLClassLoader(arrayOf(File(cordappJarPath).toURL()), currentClassLoader)
|
||||||
val concreteContracts = contracts.map(classLoader::loadClass).filter { !it.isInterface && !Modifier.isAbstract(it.modifiers) }
|
val concreteContracts = contracts.map(classLoader::loadClass).filter { !it.isInterface && !Modifier.isAbstract(it.modifiers) }
|
||||||
|
classLoader.close()
|
||||||
return concreteContracts.map { it.name }
|
return concreteContracts.map { it.name }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user