Java set a callback from ExecutorService
I have a fixedThreadPool that I am using to run a bunch of worker threads to achieve parallel execution of a task with many components. When all threads have finished, I retrieve their results (which are quite large) using a method (getResult) and write them to a file. Ultimately, to save memory and be able to see intermediate results, I'd like each thread to write its result to the file as soon as it finishes execution and then free its memory. Ordinarily, I'd add code to that effect to the end of the run() method. However, certain other objects in this class also calls these threads, but DO