mirror of
https://github.com/corda/corda.git
synced 2024-12-23 23:02:29 +00:00
Merged in rnicoll-state-machine-id (pull request #234)
Add Fiber ID to state machine change events
This commit is contained in:
commit
2c139ae40c
@ -89,13 +89,13 @@ class StateMachineManager(val serviceHub: ServiceHubInternal, tokenizableService
|
||||
val allStateMachines: List<ProtocolLogic<*>>
|
||||
get() = stateMachines.keys.map { it.logic }
|
||||
|
||||
private val _changesPublisher = PublishSubject.create<Pair<ProtocolLogic<*>, AddOrRemove>>()
|
||||
private val _changesPublisher = PublishSubject.create<Triple<ProtocolLogic<*>, AddOrRemove, Long>>()
|
||||
|
||||
val changes: Observable<Pair<ProtocolLogic<*>, AddOrRemove>>
|
||||
val changes: Observable<Triple<ProtocolLogic<*>, AddOrRemove, Long>>
|
||||
get() = _changesPublisher
|
||||
|
||||
private fun notifyChangeObservers(psm: ProtocolStateMachineImpl<*>, change: AddOrRemove) {
|
||||
_changesPublisher.onNext(Pair(psm.logic, change))
|
||||
_changesPublisher.onNext(Triple(psm.logic, change, psm.id))
|
||||
}
|
||||
|
||||
// Used to work around a small limitation in Quasar.
|
||||
|
@ -4,6 +4,7 @@ import com.r3corda.core.ThreadBox
|
||||
import com.r3corda.core.protocols.ProtocolLogic
|
||||
import com.r3corda.core.utilities.ProgressTracker
|
||||
import com.r3corda.node.services.statemachine.StateMachineManager
|
||||
import com.r3corda.protocols.TwoPartyDealProtocol
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@ -13,7 +14,7 @@ import java.util.*
|
||||
class ANSIProgressObserver(val smm: StateMachineManager) {
|
||||
|
||||
init {
|
||||
smm.changes.subscribe { change: Pair<ProtocolLogic<*>, AddOrRemove> ->
|
||||
smm.changes.subscribe { change: Triple<ProtocolLogic<*>, AddOrRemove, Long> ->
|
||||
when (change.second) {
|
||||
AddOrRemove.ADD -> addProtocolLogic(change.first)
|
||||
AddOrRemove.REMOVE -> removeProtocolLogic(change.first)
|
||||
@ -57,4 +58,4 @@ class ANSIProgressObserver(val smm: StateMachineManager) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user