Fix race in IntegrationTestingTutorial. (#594)

This commit is contained in:
Andrzej Cichocki
2017-04-27 09:15:12 +01:00
committed by GitHub
parent 3fcb773a31
commit b3894fa38a
4 changed files with 11 additions and 22 deletions

View File

@ -87,13 +87,8 @@ class FlowStateMachineImpl<R>(override val id: StateMachineRunId,
@Transient private var _resultFuture: SettableFuture<R>? = SettableFuture.create<R>()
/** This future will complete when the call method returns. */
override val resultFuture: ListenableFuture<R> get() {
return _resultFuture ?: run {
val f = SettableFuture.create<R>()
_resultFuture = f
return f
}
}
override val resultFuture: ListenableFuture<R>
get() = _resultFuture ?: SettableFuture.create<R>().also { _resultFuture = it }
// This state IS serialised, as we need it to know what the fiber is waiting for.
internal val openSessions = HashMap<Pair<FlowLogic<*>, Party>, FlowSession>()
@ -456,7 +451,7 @@ private data class FlowHandleImpl<A>(
}
@CordaSerializable
private data class FlowProgressHandleImpl<A> (
private data class FlowProgressHandleImpl<A>(
override val id: StateMachineRunId,
override val returnValue: ListenableFuture<A>,
override val progress: Observable<String>) : FlowProgressHandle<A> {