Merge pull request #7860 from corda/merge-release/os/4.11-release/os/4.12-2024-10-29-432

ENT-11275: Merging forward updates from release/os/4.11 to release/os/4.12 - 2024-10-29
This commit is contained in:
Adel El-Beik 2024-10-31 14:18:47 +00:00 committed by GitHub
commit a67e6cdb1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -310,12 +310,14 @@ abstract class FlowLogic<out T> {
@Suspendable
@JvmOverloads
open fun receiveAllMap(sessions: Map<FlowSession, Class<out Any>>, maySkipCheckpoint: Boolean = false): Map<FlowSession, UntrustworthyData<Any>> {
enforceNoPrimitiveInReceive(sessions.values)
val replies = stateMachine.suspend(
ioRequest = FlowIORequest.Receive(sessions.keys.toNonEmptySet()),
maySkipCheckpoint = maySkipCheckpoint
)
return replies.mapValues { (session, payload) -> payload.checkPayloadIs(sessions[session]!!) }
serviceHub.telemetryServiceInternal.span("${this::class.java.name}#receiveAllMap") {
enforceNoPrimitiveInReceive(sessions.values)
val replies = stateMachine.suspend(
ioRequest = FlowIORequest.Receive(sessions.keys.toNonEmptySet()),
maySkipCheckpoint = maySkipCheckpoint
)
return replies.mapValues { (session, payload) -> payload.checkPayloadIs(sessions[session]!!) }
}
}
/**
@ -332,9 +334,11 @@ abstract class FlowLogic<out T> {
@Suspendable
@JvmOverloads
open fun <R : Any> receiveAll(receiveType: Class<R>, sessions: List<FlowSession>, maySkipCheckpoint: Boolean = false): List<UntrustworthyData<R>> {
enforceNoPrimitiveInReceive(listOf(receiveType))
enforceNoDuplicates(sessions)
return castMapValuesToKnownType(receiveAllMap(associateSessionsToReceiveType(receiveType, sessions)))
serviceHub.telemetryServiceInternal.span("${this::class.java.name}#receiveAll") {
enforceNoPrimitiveInReceive(listOf(receiveType))
enforceNoDuplicates(sessions)
return castMapValuesToKnownType(receiveAllMap(associateSessionsToReceiveType(receiveType, sessions)))
}
}
/**
@ -351,8 +355,10 @@ abstract class FlowLogic<out T> {
@Suspendable
@JvmOverloads
fun sendAll(payload: Any, sessions: Set<FlowSession>, maySkipCheckpoint: Boolean = false) {
val sessionToPayload = sessions.map { it to payload }.toMap()
return sendAllMap(sessionToPayload, maySkipCheckpoint)
serviceHub.telemetryServiceInternal.span("${this::class.java.name}#sendAll") {
val sessionToPayload = sessions.map { it to payload }.toMap()
return sendAllMap(sessionToPayload, maySkipCheckpoint)
}
}
/**
@ -368,10 +374,12 @@ abstract class FlowLogic<out T> {
@Suspendable
@JvmOverloads
fun sendAllMap(payloadsPerSession: Map<FlowSession, Any>, maySkipCheckpoint: Boolean = false) {
val request = FlowIORequest.Send(
sessionToMessage = stateMachine.serialize(payloadsPerSession)
)
stateMachine.suspend(request, maySkipCheckpoint)
serviceHub.telemetryServiceInternal.span("${this::class.java.name}#sendAllMap") {
val request = FlowIORequest.Send(
sessionToMessage = stateMachine.serialize(payloadsPerSession)
)
stateMachine.suspend(request, maySkipCheckpoint)
}
}
/**