corda / net.corda.core.flows / FlowLogic / isKilled

isKilled

val isKilled: Boolean

Returns true when the current FlowLogic has been killed (has received a command to halt its progress and terminate).

Check this property in long-running computation loops to exit a flow that has been killed:

while (!isKilled) {
  // do some computation
}

Ideal usage would include throwing a KilledFlowException which will lead to the termination of the flow:

for (item in list) {
  if (isKilled) {
    throw KilledFlowException(runId)
  }
  // do some computation
}

Note, once the isKilled flag is set to true the flow may terminate once it reaches the next API function marked with the @Suspendable annotation. Therefore, it is possible to write a flow that does not interact with the isKilled flag while still terminating correctly.