Fixed a bug where if NotaryService.Type is used as an advertised service no notary is created and no obvious error occurs.

This commit is contained in:
Clinton Alexander 2016-08-12 16:45:41 +01:00
parent 9d9164980e
commit a74c491745
3 changed files with 11 additions and 5 deletions

View File

@ -27,7 +27,6 @@ class NodeRunner {
companion object {
@JvmStatic fun main(arguments: Array<String>) {
val cliParams = CliParams.parse(CliParams.parser.parse(*arguments))
val nodeDirectory = Paths.get(cliParams.baseDirectory)
createNodeRunDirectory(nodeDirectory)

View File

@ -256,7 +256,9 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration,
if (NetworkMapService.Type in serviceTypes) makeNetworkMapService()
val notaryServiceType = serviceTypes.singleOrNull { it.isSubTypeOf(NotaryService.Type) }
if (notaryServiceType != null) makeNotaryService(notaryServiceType)
if (notaryServiceType != null) {
makeNotaryService(notaryServiceType)
}
}
/**
@ -316,10 +318,14 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration,
val timestampChecker = TimestampChecker(platformClock, 30.seconds)
inNodeNotaryService = when (type) {
is SimpleNotaryService.Type -> SimpleNotaryService(smm, net, timestampChecker, uniquenessProvider, services.networkMapCache)
is ValidatingNotaryService.Type -> ValidatingNotaryService(smm, net, timestampChecker, uniquenessProvider, services.networkMapCache)
else -> null
SimpleNotaryService.Type -> SimpleNotaryService(smm, net, timestampChecker, uniquenessProvider, services.networkMapCache)
ValidatingNotaryService.Type -> ValidatingNotaryService(smm, net, timestampChecker, uniquenessProvider, services.networkMapCache)
else -> {
throw IllegalArgumentException("Notary type ${type.id} is not handled by makeNotaryService.")
}
}
require(inNodeNotaryService != null)
}
protected open fun makeIdentityService(): IdentityService {

View File

@ -24,6 +24,7 @@ abstract class NotaryService(val smm: StateMachineManager,
val timestampChecker: TimestampChecker,
val uniquenessProvider: UniquenessProvider,
networkMapCache: NetworkMapCache) : AbstractNodeService(net, networkMapCache) {
// Do not specify this as an advertised service. Use a concrete implementation.
object Type : ServiceType("corda.notary")
abstract val logger: org.slf4j.Logger