There's not really a way to set up the WorkerManager so it has no internal state, because it has to know what it has sent to SPTWorkers, and on a restart its mailboxes still contain some data. Additionally, it will have lost its references to its router and sptworkers.
Thus, we need to move all dangerous operations out of WorkerManager. This includes getting sample sets. We'll still hang on to a reference to the graph in WorkerManager, but we'll not pass it directly to the SPTWorkers; instead, they'll request the graph as requests come in, and block until they get it. Since the graph building is single threaded, we'll still only build it once. We'll do the same with the sample set caching.
There's not really a way to set up the WorkerManager so it has no internal state, because it has to know what it has sent to SPTWorkers, and on a restart its mailboxes still contain some data. Additionally, it will have lost its references to its router and sptworkers.
Thus, we need to move all dangerous operations out of WorkerManager. This includes getting sample sets. We'll still hang on to a reference to the graph in WorkerManager, but we'll not pass it directly to the SPTWorkers; instead, they'll request the graph as requests come in, and block until they get it. Since the graph building is single threaded, we'll still only build it once. We'll do the same with the sample set caching.