com.r3corda.node.services.statemachine / ProtocolStateMachineImpl

ProtocolStateMachineImpl

class ProtocolStateMachineImpl<R> : ProtocolStateMachine<R>

A ProtocolStateMachine instance is a suspendable fiber that delegates all actual logic to a ProtocolLogic instance. For any given flow there is only one PSM, even if that protocol invokes subprotocols.

These classes are created by the StateMachineManager when a new protocol is started at the topmost level. If a protocol invokes a sub-protocol, then it will pass along the PSM to the child. The call method of the topmost logic element gets to return the value that the entire state machine resolves to.





Constructors

<init> ProtocolStateMachineImpl(logic: ProtocolLogic<R>, scheduler: <ERROR CLASS>, loggerName: String)

A ProtocolStateMachine instance is a suspendable fiber that delegates all actual logic to a ProtocolLogic instance. For any given flow there is only one PSM, even if that protocol invokes subprotocols.

Properties

logger val logger: <ERROR CLASS>
logic val logic: ProtocolLogic<R>
machineId val machineId: Long

Unique ID for the deserialized instance protocol state machine. This is NOT maintained across a state machine being serialized and then deserialized.

resultFuture val resultFuture: <ERROR CLASS><R>

This future will complete when the call method returns.

serviceHub lateinit var serviceHub: ServiceHubInternal

Functions

receive fun <T : Any> receive(topic: String, sessionIDForReceive: Long, recvType: Class<T>): UntrustworthyData<T>
run fun run(): R
send fun send(topic: String, destination: Party, sessionID: Long, payload: Any): Unit
sendAndReceive fun <T : Any> sendAndReceive(topic: String, destination: Party, sessionIDForSend: Long, sessionIDForReceive: Long, payload: Any, recvType: Class<T>): UntrustworthyData<T>