Github user tillrohrmann commented on a diff in the pull request: https://github.com/apache/flink/pull/344#discussion_r24072836 --- Diff: flink-runtime/src/main/scala/org/apache/flink/runtime/jobmanager/MemoryArchivist.scala --- @@ -25,48 +25,82 @@ import org.apache.flink.runtime.jobgraph.JobID import org.apache.flink.runtime.messages.ArchiveMessages._ import org.apache.flink.runtime.messages.JobManagerMessages._ +import scala.collection.mutable.LinkedHashMap +import scala.ref.SoftReference + class MemoryArchivist(private val max_entries: Int) extends Actor with ActorLogMessages with ActorLogging { /** * Map of execution graphs belonging to recently started jobs with the time stamp of the last - * received job event. + * received job event. The insert order is preserved through a LinkedHashMap. */ - val graphs = collection.mutable.HashMap[JobID, ExecutionGraph]() - val lru = collection.mutable.Queue[JobID]() + val graphs = LinkedHashMap[JobID, SoftReference[ExecutionGraph]]() override def receiveWithLogMessages: Receive = { + /* Receive Execution Graph to archive */ case ArchiveExecutionGraph(jobID, graph) => { - graphs.update(jobID, graph) + // wrap graph inside a soft reference + graphs.update(jobID, new SoftReference(graph)) + + // clear all execution edges of the graph + val iter = graph.getAllExecutionVertices().iterator() + while (iter.hasNext) { + iter.next().clearExecutionEdges() + } --- End diff -- Why not using Scala power: graph.getAllExecutionVertices.asScala.foreach { _.clearExecutionEdges } with import scala.collection.JavaConvertes.iterableAsScalaIterableConverter in scope.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---