From c260c227a9770e860b01f8e02cab8c36fcaab355 Mon Sep 17 00:00:00 2001 From: Matthew Nesbit Date: Fri, 8 Jul 2016 10:24:51 +0100 Subject: [PATCH] Add cacheing to ServiceLoader scanning of plugins and add a TODO on whitelisting --- .../kotlin/com/r3corda/core/protocols/ProtocolLogicRef.kt | 4 +++- .../main/kotlin/com/r3corda/node/internal/AbstractNode.kt | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/main/kotlin/com/r3corda/core/protocols/ProtocolLogicRef.kt b/core/src/main/kotlin/com/r3corda/core/protocols/ProtocolLogicRef.kt index c63bfeb6cc..5b0154cb81 100644 --- a/core/src/main/kotlin/com/r3corda/core/protocols/ProtocolLogicRef.kt +++ b/core/src/main/kotlin/com/r3corda/core/protocols/ProtocolLogicRef.kt @@ -39,7 +39,9 @@ class ProtocolLogicRefFactory(private val protocolWhitelist: Map 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 - 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 by lazy { + ServiceLoader.load(CordaPluginRegistry::class.java).toList() + } /** Set to true once [start] has been successfully called. */ @Volatile var started = false