I am using this code to get an ExecutorService
in java:
this.exec = Executors.newSingleThreadExecutor();
Now I would like to know how many jobs it has processed, how many are in the queue (most importantly!), and basically all the information I could get. But an ordinary ExecutorService
does not have this information. But according to the answer in this question, I could typecast it to ThreadPoolExecutor
because that's what it returns. Well, that sounds easy... but there's one problem. My machine does not return ThreadPoolExecutor
!
Instead I am given a java.util.concurrent.Executors$FinalizableDelegatedExecutorService
which, when trying to typecast to that, is impossible because the class is not visible.
So how can I find out the status of my ExecutorService
?
If you are very curious and would like to know what I am using my ExecutorService
for (if that matters), read this question that I have asked earlier. It's basically for SQL statements.