Move db commit to after "protocol completed" future is set.

Move db commit to after "protocol completed" future is set.
This commit is contained in:
rick.parker 2016-09-16 13:54:33 +01:00
parent 9a6c6b17d6
commit 476db876d9

View File

@ -72,16 +72,16 @@ class ProtocolStateMachineImpl<R>(val logic: ProtocolLogic<R>,
val result = try {
logic.call()
} catch (t: Throwable) {
commitTransaction()
actionOnEnd()
_resultFuture?.setException(t)
commitTransaction()
throw ExecutionException(t)
}
// This is to prevent actionOnEnd being called twice if it throws an exception
commitTransaction()
actionOnEnd()
_resultFuture?.set(result)
commitTransaction()
return result
}