mirror of
https://github.com/corda/corda.git
synced 2025-06-17 14:48:16 +00:00
Retire setup, and start return value. (#1101)
This commit is contained in:
@ -9,7 +9,6 @@ import com.google.common.util.concurrent.SettableFuture
|
||||
import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner
|
||||
import io.github.lukehutch.fastclasspathscanner.scanner.ScanResult
|
||||
import net.corda.core.crypto.*
|
||||
import net.corda.core.crypto.composite.CompositeKey
|
||||
import net.corda.core.flatMap
|
||||
import net.corda.core.flows.*
|
||||
import net.corda.core.identity.Party
|
||||
@ -23,7 +22,6 @@ import net.corda.core.node.services.*
|
||||
import net.corda.core.node.services.NetworkMapCache.MapChange
|
||||
import net.corda.core.serialization.SerializeAsToken
|
||||
import net.corda.core.serialization.SingletonSerializeAsToken
|
||||
import net.corda.core.serialization.deserialize
|
||||
import net.corda.core.transactions.SignedTransaction
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.debug
|
||||
@ -160,7 +158,7 @@ abstract class AbstractNode(open val configuration: NodeConfiguration,
|
||||
return configuration.myLegalName.locationOrNull?.let { CityDatabase[it] }
|
||||
}
|
||||
|
||||
open fun start(): AbstractNode {
|
||||
open fun start() {
|
||||
require(!started) { "Node has already been started" }
|
||||
|
||||
if (configuration.devMode) {
|
||||
@ -221,7 +219,6 @@ abstract class AbstractNode(open val configuration: NodeConfiguration,
|
||||
_services.schedulerService.start()
|
||||
}
|
||||
started = true
|
||||
return this
|
||||
}
|
||||
|
||||
private class ServiceInstantiationException(cause: Throwable?) : Exception(cause)
|
||||
@ -566,14 +563,6 @@ abstract class AbstractNode(open val configuration: NodeConfiguration,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run any tasks that are needed to ensure the node is in a correct state before running start().
|
||||
*/
|
||||
open fun setup(): AbstractNode {
|
||||
configuration.baseDirectory.createDirectories()
|
||||
return this
|
||||
}
|
||||
|
||||
private fun makeAdvertisedServices(tokenizableServices: MutableList<Any>) {
|
||||
val serviceTypes = info.advertisedServices.map { it.info.type }
|
||||
if (NetworkMapService.type in serviceTypes) makeNetworkMapService()
|
||||
|
@ -294,7 +294,7 @@ open class Node(override val configuration: FullNodeConfiguration,
|
||||
|
||||
val startupComplete: ListenableFuture<Unit> = SettableFuture.create()
|
||||
|
||||
override fun start(): Node {
|
||||
override fun start() {
|
||||
if (initialiseSerialization) {
|
||||
initialiseSerialization()
|
||||
}
|
||||
@ -326,7 +326,6 @@ open class Node(override val configuration: FullNodeConfiguration,
|
||||
shutdownHook = addShutdownHook {
|
||||
stop()
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
private fun initialiseSerialization() {
|
||||
@ -344,12 +343,6 @@ open class Node(override val configuration: FullNodeConfiguration,
|
||||
(network as NodeMessagingClient).run(messageBroker!!.serverControl)
|
||||
}
|
||||
|
||||
// TODO: Do we really need setup?
|
||||
override fun setup(): Node {
|
||||
super.setup()
|
||||
return this
|
||||
}
|
||||
|
||||
private var shutdown = false
|
||||
|
||||
override fun stop() {
|
||||
|
@ -108,10 +108,9 @@ class AttachmentTests {
|
||||
overrideServices: Map<ServiceInfo, KeyPair>?,
|
||||
entropyRoot: BigInteger): MockNetwork.MockNode {
|
||||
return object : MockNetwork.MockNode(config, network, networkMapAddr, advertisedServices, id, overrideServices, entropyRoot) {
|
||||
override fun start(): MockNetwork.MockNode {
|
||||
override fun start() {
|
||||
super.start()
|
||||
attachments.checkAttachmentsOnLoad = false
|
||||
return this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user