From cf4363dc2e585eebb19ec4e667cbe26fca0514ee Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Tue, 11 Apr 2017 14:37:08 +0200 Subject: [PATCH] Minor: more helpful warning when an observable is leaked. --- .../kotlin/net/corda/client/rpc/CordaRPCClientImpl.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/rpc/src/main/kotlin/net/corda/client/rpc/CordaRPCClientImpl.kt b/client/rpc/src/main/kotlin/net/corda/client/rpc/CordaRPCClientImpl.kt index 46460ad55f..c5ba696ce1 100644 --- a/client/rpc/src/main/kotlin/net/corda/client/rpc/CordaRPCClientImpl.kt +++ b/client/rpc/src/main/kotlin/net/corda/client/rpc/CordaRPCClientImpl.kt @@ -389,9 +389,13 @@ class CordaRPCClientImpl(private val session: ClientSession, false } if (closed) { - rpcLog.warn("A hot observable returned from an RPC ($rpcName) was never subscribed to. " + - "This wastes server-side resources because it was queueing observations for retrieval. " + - "It is being closed now, but please adjust your code to subscribe and unsubscribe from the observable to close it explicitly.", rpcLocation) + rpcLog.warn("""A hot observable returned from an RPC ($rpcName) was never subscribed to. + This wastes server-side resources because it was queueing observations for retrieval. + It is being closed now, but please adjust your code to call .notUsed() on the observable + to close it explicitly. (Java users: subscribe to it then unsubscribe). This warning + will appear less frequently in future versions of the platform and you can ignore it + if you want to. + """.trimIndent().replace('\n', ' '), rpcLocation) } } }