mirror of
https://github.com/corda/corda.git
synced 2025-02-22 18:12:53 +00:00
Merge pull request #45 from corda/parkri-external-observations-2
Move Flow returned Future complete outside database transaction
This commit is contained in:
commit
a007ecf980
@ -86,15 +86,16 @@ class FlowStateMachineImpl<R>(override val id: StateMachineRunId,
|
|||||||
val result = try {
|
val result = try {
|
||||||
logic.call()
|
logic.call()
|
||||||
} catch (t: Throwable) {
|
} catch (t: Throwable) {
|
||||||
processException(t)
|
actionOnEnd()
|
||||||
commitTransaction()
|
commitTransaction()
|
||||||
|
_resultFuture?.setException(t)
|
||||||
throw ExecutionException(t)
|
throw ExecutionException(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is to prevent actionOnEnd being called twice if it throws an exception
|
// This is to prevent actionOnEnd being called twice if it throws an exception
|
||||||
actionOnEnd()
|
actionOnEnd()
|
||||||
_resultFuture?.set(result)
|
|
||||||
commitTransaction()
|
commitTransaction()
|
||||||
|
_resultFuture?.set(result)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,8 +265,8 @@ class FlowStateMachineImpl<R>(override val id: StateMachineRunId,
|
|||||||
// This can get called in actionOnSuspend *after* we commit the database transaction, so optionally open a new one here.
|
// This can get called in actionOnSuspend *after* we commit the database transaction, so optionally open a new one here.
|
||||||
databaseTransaction(database) {
|
databaseTransaction(database) {
|
||||||
actionOnEnd()
|
actionOnEnd()
|
||||||
_resultFuture?.setException(t)
|
|
||||||
}
|
}
|
||||||
|
_resultFuture?.setException(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun resume(scheduler: FiberScheduler) {
|
internal fun resume(scheduler: FiberScheduler) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user