Address PR 207 comments

This commit is contained in:
Andras Slemmer 2017-02-02 11:44:18 +00:00
parent de63f90745
commit 4afd404db4
3 changed files with 7 additions and 11 deletions

View File

@ -112,9 +112,10 @@ interface CordaRPCOps : RPCOps {
fun currentNodeTime(): Instant
/**
* Returns whether the node has registered with the network map.
* Returns an Observable emitting a single Unit once the node is registered with the network map.
*/
fun isRegisteredWithNetworkMap(): Boolean
@RPCReturnsObservables
fun waitUntilRegisteredWithNetworkMap(): Observable<Unit>
// TODO These need rethinking. Instead of these direct calls we should have a way of replicating a subset of
// the node's state locally and query that directly.

View File

@ -334,7 +334,7 @@ open class DriverDSL(
client.start(ArtemisMessagingComponent.NODE_USER, ArtemisMessagingComponent.NODE_USER)
return@poll client.proxy()
} catch(e: Exception) {
log.error("Retrying query node info at $nodeAddress")
log.error("Exception $e, Retrying RPC connection at $nodeAddress")
null
}
}
@ -380,12 +380,8 @@ open class DriverDSL(
registerProcess(processFuture)
return processFuture.flatMap { process ->
establishRpc(messagingAddress, configuration).flatMap { rpc ->
poll(executorService, "$name to register with the network map") {
if (rpc.isRegisteredWithNetworkMap()) {
NodeHandle(rpc.nodeIdentity(), rpc, configuration, process)
} else {
null
}
rpc.waitUntilRegisteredWithNetworkMap().toFuture().map {
NodeHandle(rpc.nodeIdentity(), rpc, configuration, process)
}
}
}

View File

@ -111,8 +111,7 @@ class CordaRPCOpsImpl(
}
}
override fun isRegisteredWithNetworkMap() = services.networkMapCache.mapServiceRegistered.isDone
override fun waitUntilRegisteredWithNetworkMap() = services.networkMapCache.mapServiceRegistered.toObservable()
override fun partyFromKey(key: CompositeKey) = services.identityService.partyFromKey(key)
override fun partyFromName(name: String) = services.identityService.partyFromName(name)