mirror of
https://github.com/corda/corda.git
synced 2025-06-02 07:30:53 +00:00
This reverts commit d983b7dd7073272c76553d937b3900608aa2bfa5.
This commit is contained in:
parent
7a929f177c
commit
f5a966ee3b
@ -89,12 +89,7 @@ class ReconnectingCordaRPCOps private constructor(
|
||||
*
|
||||
* Note that this method does not guarantee 100% that the flow will not be started twice.
|
||||
*/
|
||||
fun runFlowWithLogicalRetry(
|
||||
runFlow: (CordaRPCOps) -> StateMachineRunId,
|
||||
hasFlowStarted: (CordaRPCOps) -> Boolean,
|
||||
onFlowConfirmed: () -> Unit = {},
|
||||
timeout: Duration = 4.seconds
|
||||
) {
|
||||
fun runFlowWithLogicalRetry(runFlow: (CordaRPCOps) -> StateMachineRunId, hasFlowStarted: (CordaRPCOps) -> Boolean, onFlowConfirmed: () -> Unit = {}, timeout: Duration = 4.seconds) {
|
||||
try {
|
||||
runFlow(this)
|
||||
onFlowConfirmed()
|
||||
@ -254,8 +249,9 @@ class ReconnectingCordaRPCOps private constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private tailrec fun doInvoke(method: Method, args: Array<out Any>?): Any? {
|
||||
// will stop recursing when [method.invoke] succeeds
|
||||
private fun doInvoke(method: Method, args: Array<out Any>?): Any? {
|
||||
// will stop looping when [method.invoke] succeeds
|
||||
while (true) {
|
||||
try {
|
||||
log.debug { "Invoking RPC $method..." }
|
||||
return method.invoke(reconnectingRPCConnection.proxy, *(args ?: emptyArray())).also {
|
||||
@ -268,10 +264,8 @@ class ReconnectingCordaRPCOps private constructor(
|
||||
reconnectingRPCConnection.reconnectOnError(e)
|
||||
}
|
||||
is ConnectionFailureException -> {
|
||||
if (!reconnectingRPCConnection.proxy.isWaitingForShutdown()) {
|
||||
log.error("Failed to perform operation ${method.name}. Connection dropped. Retrying....", e)
|
||||
reconnectingRPCConnection.reconnectOnError(e)
|
||||
}
|
||||
checkIfIsStartFlow(method, e)
|
||||
}
|
||||
is RPCException -> {
|
||||
@ -287,7 +281,7 @@ class ReconnectingCordaRPCOps private constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
return doInvoke(method, args)
|
||||
}
|
||||
}
|
||||
|
||||
override fun invoke(proxy: Any, method: Method, args: Array<out Any>?): Any? {
|
||||
|
Loading…
x
Reference in New Issue
Block a user