mirror of
https://github.com/corda/corda.git
synced 2025-06-21 16:49:45 +00:00
ENT-1670: update kdocs and unit test for better user experience (#2875)
* ENT-1670: update kdocs and unit test for better user experience regarding RPC connection loss * RPCStabilityTests: move doOnError logic to onError handler
This commit is contained in:
@ -305,16 +305,21 @@ class RPCStabilityTests {
|
|||||||
|
|
||||||
var terminateHandlerCalled = false
|
var terminateHandlerCalled = false
|
||||||
var errorHandlerCalled = false
|
var errorHandlerCalled = false
|
||||||
|
var exceptionMessage: String? = null
|
||||||
val subscription = client.subscribe()
|
val subscription = client.subscribe()
|
||||||
.doOnTerminate{ terminateHandlerCalled = true }
|
.doOnTerminate{ terminateHandlerCalled = true }
|
||||||
.doOnError { errorHandlerCalled = true }
|
.subscribe({}, {
|
||||||
.subscribe()
|
errorHandlerCalled = true
|
||||||
|
//log exception
|
||||||
|
exceptionMessage = it.message
|
||||||
|
})
|
||||||
|
|
||||||
serverFollower.shutdown()
|
serverFollower.shutdown()
|
||||||
Thread.sleep(100)
|
Thread.sleep(100)
|
||||||
|
|
||||||
assertTrue(terminateHandlerCalled)
|
assertTrue(terminateHandlerCalled)
|
||||||
assertTrue(errorHandlerCalled)
|
assertTrue(errorHandlerCalled)
|
||||||
|
assertEquals("Connection failure detected.", exceptionMessage)
|
||||||
assertTrue(subscription.isUnsubscribed)
|
assertTrue(subscription.isUnsubscribed)
|
||||||
|
|
||||||
clientFollower.shutdown() // Driver would do this after the new server, causing hang.
|
clientFollower.shutdown() // Driver would do this after the new server, causing hang.
|
||||||
|
@ -89,6 +89,10 @@ interface CordaRPCClientConfiguration {
|
|||||||
* with an error, the observable is closed and you can't then re-subscribe again: you'll have to re-request a fresh
|
* with an error, the observable is closed and you can't then re-subscribe again: you'll have to re-request a fresh
|
||||||
* observable with another RPC.
|
* observable with another RPC.
|
||||||
*
|
*
|
||||||
|
* In case of loss of connection to the server, the client will try to reconnect using the settings provided via
|
||||||
|
* [CordaRPCClientConfiguration]. While attempting failover, current and future RPC calls will throw
|
||||||
|
* [RPCException] and previously returned observables will call onError().
|
||||||
|
*
|
||||||
* @param hostAndPort The network address to connect to.
|
* @param hostAndPort The network address to connect to.
|
||||||
* @param configuration An optional configuration used to tweak client behaviour.
|
* @param configuration An optional configuration used to tweak client behaviour.
|
||||||
* @param sslConfiguration An optional [SSLConfiguration] used to enable secure communication with the server.
|
* @param sslConfiguration An optional [SSLConfiguration] used to enable secure communication with the server.
|
||||||
|
Reference in New Issue
Block a user