mirror of
https://github.com/corda/corda.git
synced 2025-06-18 15:18:16 +00:00
Add killFlow
This commit is contained in:
@ -260,6 +260,13 @@ interface CordaRPCOps : RPCOps {
|
|||||||
@RPCReturnsObservables
|
@RPCReturnsObservables
|
||||||
fun <T> startTrackedFlowDynamic(logicType: Class<out FlowLogic<T>>, vararg args: Any?): FlowProgressHandle<T>
|
fun <T> startTrackedFlowDynamic(logicType: Class<out FlowLogic<T>>, vararg args: Any?): FlowProgressHandle<T>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to kill a flow. This is not a clean termination and should be reserved for exceptional cases such as stuck fibers.
|
||||||
|
*
|
||||||
|
* @return whether the flow existed and was killed.
|
||||||
|
*/
|
||||||
|
fun killFlow(id: StateMachineRunId): Boolean
|
||||||
|
|
||||||
/** Returns Node's NodeInfo, assuming this will not change while the node is running. */
|
/** Returns Node's NodeInfo, assuming this will not change while the node is running. */
|
||||||
fun nodeInfo(): NodeInfo
|
fun nodeInfo(): NodeInfo
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import net.corda.core.crypto.SecureHash
|
|||||||
import net.corda.core.flows.FlowInitiator
|
import net.corda.core.flows.FlowInitiator
|
||||||
import net.corda.core.flows.FlowLogic
|
import net.corda.core.flows.FlowLogic
|
||||||
import net.corda.core.flows.StartableByRPC
|
import net.corda.core.flows.StartableByRPC
|
||||||
|
import net.corda.core.flows.StateMachineRunId
|
||||||
import net.corda.core.identity.AbstractParty
|
import net.corda.core.identity.AbstractParty
|
||||||
import net.corda.core.identity.CordaX500Name
|
import net.corda.core.identity.CordaX500Name
|
||||||
import net.corda.core.identity.Party
|
import net.corda.core.identity.Party
|
||||||
@ -109,6 +110,8 @@ internal class CordaRPCOpsImpl(
|
|||||||
return snapshot
|
return snapshot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun killFlow(id: StateMachineRunId) = smm.killFlow(id)
|
||||||
|
|
||||||
override fun stateMachinesFeed(): DataFeed<List<StateMachineInfo>, StateMachineUpdate> {
|
override fun stateMachinesFeed(): DataFeed<List<StateMachineInfo>, StateMachineUpdate> {
|
||||||
return database.transaction {
|
return database.transaction {
|
||||||
val (allStateMachines, changes) = smm.track()
|
val (allStateMachines, changes) = smm.track()
|
||||||
|
@ -4,6 +4,7 @@ import net.corda.client.rpc.PermissionException
|
|||||||
import net.corda.core.contracts.ContractState
|
import net.corda.core.contracts.ContractState
|
||||||
import net.corda.core.crypto.SecureHash
|
import net.corda.core.crypto.SecureHash
|
||||||
import net.corda.core.flows.FlowLogic
|
import net.corda.core.flows.FlowLogic
|
||||||
|
import net.corda.core.flows.StateMachineRunId
|
||||||
import net.corda.core.identity.AbstractParty
|
import net.corda.core.identity.AbstractParty
|
||||||
import net.corda.core.identity.CordaX500Name
|
import net.corda.core.identity.CordaX500Name
|
||||||
import net.corda.core.identity.Party
|
import net.corda.core.identity.Party
|
||||||
@ -73,6 +74,10 @@ class RpcAuthorisationProxy(private val implementation: CordaRPCOps, private val
|
|||||||
implementation.startTrackedFlowDynamic(logicType, *args)
|
implementation.startTrackedFlowDynamic(logicType, *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun killFlow(id: StateMachineRunId): Boolean = guard("killFlow") {
|
||||||
|
return implementation.killFlow(id)
|
||||||
|
}
|
||||||
|
|
||||||
override fun nodeInfo(): NodeInfo = guard("nodeInfo", implementation::nodeInfo)
|
override fun nodeInfo(): NodeInfo = guard("nodeInfo", implementation::nodeInfo)
|
||||||
|
|
||||||
override fun notaryIdentities(): List<Party> = guard("notaryIdentities", implementation::notaryIdentities)
|
override fun notaryIdentities(): List<Party> = guard("notaryIdentities", implementation::notaryIdentities)
|
||||||
|
@ -5,6 +5,7 @@ import net.corda.core.contracts.ContractState
|
|||||||
import net.corda.core.crypto.SecureHash
|
import net.corda.core.crypto.SecureHash
|
||||||
import net.corda.core.doOnError
|
import net.corda.core.doOnError
|
||||||
import net.corda.core.flows.FlowLogic
|
import net.corda.core.flows.FlowLogic
|
||||||
|
import net.corda.core.flows.StateMachineRunId
|
||||||
import net.corda.core.identity.AbstractParty
|
import net.corda.core.identity.AbstractParty
|
||||||
import net.corda.core.identity.CordaX500Name
|
import net.corda.core.identity.CordaX500Name
|
||||||
import net.corda.core.internal.concurrent.doOnError
|
import net.corda.core.internal.concurrent.doOnError
|
||||||
@ -88,6 +89,8 @@ class RpcExceptionHandlingProxy(private val delegate: SecureCordaRPCOps) : Corda
|
|||||||
|
|
||||||
override fun acceptNewNetworkParameters(parametersHash: SecureHash) = wrap { delegate.acceptNewNetworkParameters(parametersHash) }
|
override fun acceptNewNetworkParameters(parametersHash: SecureHash) = wrap { delegate.acceptNewNetworkParameters(parametersHash) }
|
||||||
|
|
||||||
|
override fun killFlow(id: StateMachineRunId) = wrap { delegate.killFlow(id) }
|
||||||
|
|
||||||
override fun nodeInfo() = wrap(delegate::nodeInfo)
|
override fun nodeInfo() = wrap(delegate::nodeInfo)
|
||||||
|
|
||||||
override fun notaryIdentities() = wrap(delegate::notaryIdentities)
|
override fun notaryIdentities() = wrap(delegate::notaryIdentities)
|
||||||
|
Reference in New Issue
Block a user