Thinking about this, I think all this is is a callback function that takes the generation instance as a parameter. You can change the run() method to onGenerationDrained(generation), then this can be passed to the constructor of ExportGeneration.