Actually check the shutdown status before materializing anything (#24307)
This commit is contained in:
parent
0529f1814b
commit
df40ef7bc0
2 changed files with 30 additions and 9 deletions
|
|
@ -420,6 +420,7 @@ private final case class SavedIslandData(islandGlobalOffset: Int, lastVisitedOff
|
|||
defaultAttributes: Attributes,
|
||||
defaultPhase: Phase[Any],
|
||||
phases: Map[IslandTag, Phase[Any]]): Mat = {
|
||||
if (isShutdown) throw new IllegalStateException("Trying to materialize stream after materializer has been shutdown")
|
||||
val islandTracking = new IslandTracking(phases, settings, defaultAttributes, defaultPhase, this, islandNamePrefix = createFlowName() + "-")
|
||||
|
||||
var current: Traversal = graph.traversalBuilder.traversal
|
||||
|
|
@ -496,11 +497,19 @@ private final case class SavedIslandData(islandGlobalOffset: Int, lastVisitedOff
|
|||
}
|
||||
}
|
||||
|
||||
islandTracking.getCurrentPhase.onIslandReady()
|
||||
islandTracking.allNestedIslandsReady()
|
||||
def shutdownWhileMaterializingFailure =
|
||||
new IllegalStateException("Materializer shutdown while materializing stream")
|
||||
try {
|
||||
islandTracking.getCurrentPhase.onIslandReady()
|
||||
islandTracking.allNestedIslandsReady()
|
||||
|
||||
if (Debug) println("--- Finished materialization")
|
||||
matValueStack.peekLast().asInstanceOf[Mat]
|
||||
|
||||
} finally {
|
||||
if (isShutdown) throw shutdownWhileMaterializingFailure
|
||||
}
|
||||
|
||||
if (Debug) println("--- Finished materialization")
|
||||
matValueStack.peekLast().asInstanceOf[Mat]
|
||||
}
|
||||
|
||||
private def wireInlets(islandTracking: IslandTracking, mod: StreamLayout.AtomicModule[Shape, Any], logic: Any): Unit = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue