mirror of
https://github.com/corda/corda.git
synced 2025-04-14 22:46:57 +00:00
Add cacheing to ServiceLoader scanning of plugins and add a TODO on whitelisting
This commit is contained in:
parent
db131eb2c0
commit
c260c227a9
core/src/main/kotlin/com/r3corda/core/protocols
node/src/main/kotlin/com/r3corda/node/internal
@ -39,7 +39,9 @@ class ProtocolLogicRefFactory(private val protocolWhitelist: Map<String, Set<Str
|
||||
// Pending real dependence on AppContext for class loading etc
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
private fun validateArgClassName(className: String, argClassName: String, appContext: AppContext) {
|
||||
// Accept standard java.lang.* and kotlin.* types
|
||||
// TODO: consider more carefully what to whitelist and how to secure protocols
|
||||
// For now automatically accept standard java.lang.* and kotlin.* types.
|
||||
// All other types require manual specification at ProtocolLogicRefFactory construction time.
|
||||
if (argClassName.startsWith("java.lang.") || argClassName.startsWith("kotlin.")) {
|
||||
return
|
||||
}
|
||||
|
@ -134,9 +134,10 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration,
|
||||
val networkMapRegistrationFuture: ListenableFuture<Unit>
|
||||
get() = _networkMapRegistrationFuture
|
||||
|
||||
/** fetch CordaPluginRegistry classes registered in META-INF/services/com.r3corda.core.node.CordaPluginRegistry files that exist in the classpath */
|
||||
protected val pluginRegistries: List<CordaPluginRegistry>
|
||||
get() = ServiceLoader.load(CordaPluginRegistry::class.java).toList()
|
||||
/** Fetch CordaPluginRegistry classes registered in META-INF/services/com.r3corda.core.node.CordaPluginRegistry files that exist in the classpath */
|
||||
protected val pluginRegistries: List<CordaPluginRegistry> by lazy {
|
||||
ServiceLoader.load(CordaPluginRegistry::class.java).toList()
|
||||
}
|
||||
|
||||
/** Set to true once [start] has been successfully called. */
|
||||
@Volatile var started = false
|
||||
|
Loading…
x
Reference in New Issue
Block a user