Close classloader to release associated file (#2635)

[CORDA-1113] Close classloader to release associated file
This commit is contained in:
Maksymilian Pawlak 2018-02-26 15:01:57 +00:00 committed by GitHub
parent 7517270dde
commit cc84b34dca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 }
} }