CORDA-1355: Introduce a dedicated property which controls what is going to be in scope for classpath scanning (#2977)

* CORDA-1355: Introduce a dedicated property which controls what is going to be in scope for classpath scanning

* CORDA-1355: Update change log

* CORDA-1355: Minor change to improve readability.

* CORDA-1355: Custom serializers documentation update to mention new system property.
This commit is contained in:
Viktor Kolomeyko
2018-04-23 13:55:40 +01:00
committed by GitHub
parent bf4d8ba08c
commit 3aaa176dd4
5 changed files with 57 additions and 12 deletions

View File

@ -39,6 +39,7 @@ import net.corda.nodeapi.internal.crypto.X509KeyStore
import net.corda.nodeapi.internal.crypto.X509Utilities
import net.corda.nodeapi.internal.network.NetworkParametersCopier
import net.corda.nodeapi.internal.network.NodeInfoFilesCopier
import net.corda.nodeapi.internal.serialization.amqp.AbstractAMQPSerializationScheme
import net.corda.testing.core.ALICE_NAME
import net.corda.testing.core.BOB_NAME
import net.corda.testing.core.DUMMY_BANK_A_NAME
@ -755,10 +756,11 @@ class DriverDSLImpl(
val systemProperties = mutableMapOf(
"name" to config.corda.myLegalName,
"visualvm.display.name" to "corda-${config.corda.myLegalName}",
"java.io.tmpdir" to System.getProperty("java.io.tmpdir"), // Inherit from parent process
"log4j2.debug" to if (debugPort != null) "true" else "false"
)
systemProperties += inheritFromParentProcess()
if (cordappPackages.isNotEmpty()) {
systemProperties += Node.scanPackagesSystemProperty to cordappPackages.joinToString(Node.scanPackagesSeparator)
}
@ -802,15 +804,26 @@ class DriverDSLImpl(
className = className, // cannot directly get class for this, so just use string
arguments = listOf("--base-directory", handle.baseDirectory.toString()),
jdwpPort = debugPort,
extraJvmArguments = listOf(
"-Dname=node-${handle.p2pAddress}-webserver",
"-Djava.io.tmpdir=${System.getProperty("java.io.tmpdir")}" // Inherit from parent process
),
extraJvmArguments = listOf("-Dname=node-${handle.p2pAddress}-webserver") +
inheritFromParentProcess().map { "-D${it.first}=${it.second}" },
workingDirectory = null,
maximumHeapSize = maximumHeapSize
)
}
private val propertiesInScope = setOf("java.io.tmpdir", AbstractAMQPSerializationScheme.SCAN_SPEC_PROP_NAME)
private fun inheritFromParentProcess() : Iterable<Pair<String, String>> {
return propertiesInScope.flatMap { propName ->
val propValue : String? = System.getProperty(propName)
if(propValue == null) {
emptySet()
} else {
setOf(Pair(propName, propValue))
}
}
}
private fun NodeHandleInternal.toWebServerConfig(): Config {
var config = ConfigFactory.empty()