I am running several tasks in a ThreadPoolExecutor. I initialise it as follows:
private VideoExportExecutor executor;
private BlockingQueue<Runnable> jobQueue;
public void initialiseVideoProcessor()
{
jobQueue = new LinkedBlockingQueue<Runnable>();
executor = new VideoExportExecutor(1, 1, Long.MAX_VALUE, TimeUnit.SECONDS, jobQueue);
}
I have made my own implementation of runnable (VideoExportThread
) which contains a getProgress()
method to keep track of the progress of submitted tasks. I submit instances of this as follows:
executor.submit(new VideoExportThread(gcmPath));
I am after a way to query the executor/blockingQueue for current/pending threads. I have tried to use jobQueue.toArray()
and to override the executor method beforeExecute(Thread t, Runnable r)
but in both cases the returned runnable is of type FutureTask which does not contain much data. Is there a way for me to use it to retrieve my original VideoExportThread
instance in order to identify which ones are running and to query its progress?
Thanks