Why not simply keep a list of your Runnables?
List<Runnable> runnables = new ArrayList<> ();
VideoExportThread r = new VideoExportThread(gcmPath);
runnables.add(r);
executor.submit(r);
Also note that executor.submit(r);
returns a Future
- you can call its isDone()
method to check if the submitted task is still running.
Side comment: there might be a good reason to manage the job queue manually, but if not, you use one of the factory methods to make your life easier. For example: ExecutorService executor = Executors.newCachedThreadPool();
.