Rename net to network (#773)

* So net no longer interferes with IntelliJ auto-import of net.* packages
* Use mockNet for MockNetwork to avoid clashing with Node network
This commit is contained in:
Andrzej Cichocki
2017-06-05 14:00:14 +01:00
committed by GitHub
parent e5fba5d0af
commit 101e96d8d7
38 changed files with 353 additions and 354 deletions

View File

@ -233,7 +233,7 @@ class MockNetwork(private val networkSendManuallyPumped: Boolean = false,
@Suppress("unused") val place: PhysicalLocation get() = findMyLocation()!!
fun pumpReceive(block: Boolean = false): InMemoryMessagingNetwork.MessageTransfer? {
return (net as InMemoryMessagingNetwork.InMemoryMessaging).pumpReceive(block)
return (network as InMemoryMessagingNetwork.InMemoryMessaging).pumpReceive(block)
}
fun disableDBCloseOnStop() {
@ -382,7 +382,7 @@ class MockNetwork(private val networkSendManuallyPumped: Boolean = false,
}
@Suppress("unused") // This is used from the network visualiser tool.
fun addressToNode(address: SingleMessageRecipient): MockNode = nodes.single { it.net.myAddress == address }
fun addressToNode(address: SingleMessageRecipient): MockNode = nodes.single { it.network.myAddress == address }
fun startNodes() {
require(nodes.isNotEmpty())

View File

@ -45,7 +45,7 @@ class SimpleNode(val config: NodeConfiguration, val address: HostAndPort = freeL
val executor = ServiceAffinityExecutor(config.myLegalName.commonName, 1)
val broker = ArtemisMessagingServer(config, address.port, rpcAddress.port, InMemoryNetworkMapCache(), userService)
val networkMapRegistrationFuture: SettableFuture<Unit> = SettableFuture.create<Unit>()
val net = database.transaction {
val network = database.transaction {
NodeMessagingClient(
config,
MOCK_VERSION_INFO,
@ -59,18 +59,18 @@ class SimpleNode(val config: NodeConfiguration, val address: HostAndPort = freeL
fun start() {
broker.start()
net.start(
network.start(
object : RPCOps {
override val protocolVersion = 0
},
userService)
thread(name = config.myLegalName.commonName) {
net.run(broker.serverControl)
network.run(broker.serverControl)
}
}
override fun close() {
net.stop()
network.stop()
broker.stop()
databaseWithCloseable.first.close()
executor.shutdownNow()