ENT-3000 Start pooling classpath scanning and related fixes (#4664)

* Start pooling classpath scanning

Quickly patch synchronisation of attachment class loader cache.  Needs a revisit but more complicated due to DJVM.

Annotate away for DJVM

Take ClassGraph utils into their own file so we can exclude for DJVM

Clean up a little

* Daemonize the threads

* Seems to be some concurrency problems with use of ClassGraph.  Using a mutex for now to work around.
This commit is contained in:
Rick Parker
2019-01-30 10:35:20 +00:00
committed by GitHub
parent 9ade410109
commit 7dc7313fb7
9 changed files with 30 additions and 19 deletions

View File

@ -9,7 +9,6 @@ import net.corda.core.crypto.SecureHash
import net.corda.core.internal.*
import org.slf4j.LoggerFactory
import java.io.InputStream
import java.net.URLClassLoader
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.StandardCopyOption
@ -28,7 +27,7 @@ class ContractsJarFile(private val file: Path) : ContractsJar {
override val hash: SecureHash by lazy(LazyThreadSafetyMode.NONE, file::hash)
override fun scan(): List<ContractClassName> {
val scanResult = ClassGraph().overrideClasspath(singleton(file)).enableClassInfo().scan()
val scanResult = ClassGraph().overrideClasspath(singleton(file)).enableClassInfo().pooledScan()
return scanResult.use { result ->
coreContractClasses