mirror of
https://github.com/corda/corda.git
synced 2025-02-01 00:45:59 +00:00
Incorporate comments from PR
This commit is contained in:
parent
c57f265cce
commit
601b2faf5f
@ -123,10 +123,10 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration,
|
|||||||
lateinit var api: APIServer
|
lateinit var api: APIServer
|
||||||
lateinit var scheduler: SchedulerService
|
lateinit var scheduler: SchedulerService
|
||||||
lateinit var protocolLogicFactory: ProtocolLogicRefFactory
|
lateinit var protocolLogicFactory: ProtocolLogicRefFactory
|
||||||
var customServices: List<Any> = emptyList()
|
val customServices: ArrayList<Any> = ArrayList()
|
||||||
inline fun <reified T: Any>getCustomService() : T {
|
|
||||||
return customServices.single{ x-> x is T } as T
|
/** Locates and returns a service of the given type if loaded, or throws an exception if not found. */
|
||||||
}
|
inline fun <reified T: Any> findService() = customServices.filterIsInstance<T>().single()
|
||||||
|
|
||||||
var isPreviousCheckpointsPresent = false
|
var isPreviousCheckpointsPresent = false
|
||||||
private set
|
private set
|
||||||
@ -168,8 +168,8 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration,
|
|||||||
|
|
||||||
val tokenizableServices = mutableListOf(storage, net, wallet, keyManagement, identity, platformClock, scheduler)
|
val tokenizableServices = mutableListOf(storage, net, wallet, keyManagement, identity, platformClock, scheduler)
|
||||||
|
|
||||||
buildPluginServices(tokenizableServices)
|
customServices.clear()
|
||||||
|
customServices.addAll(buildPluginServices(tokenizableServices))
|
||||||
|
|
||||||
smm = StateMachineManager(services,
|
smm = StateMachineManager(services,
|
||||||
listOf(tokenizableServices),
|
listOf(tokenizableServices),
|
||||||
@ -204,7 +204,7 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration,
|
|||||||
return ProtocolLogicRefFactory(protocolWhitelist)
|
return ProtocolLogicRefFactory(protocolWhitelist)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildPluginServices(tokenizableServices: MutableList<Any>) {
|
private fun buildPluginServices(tokenizableServices: MutableList<Any>): List<Any> {
|
||||||
val pluginServices = pluginRegistries.flatMap { x -> x.servicePlugins }
|
val pluginServices = pluginRegistries.flatMap { x -> x.servicePlugins }
|
||||||
val serviceList = mutableListOf<Any>()
|
val serviceList = mutableListOf<Any>()
|
||||||
for (serviceClass in pluginServices) {
|
for (serviceClass in pluginServices) {
|
||||||
@ -215,7 +215,7 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration,
|
|||||||
_servicesThatAcceptUploads += service
|
_servicesThatAcceptUploads += service
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
customServices = serviceList
|
return serviceList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user