I have an ExecutorService that I use to multithread the processing of the some text, and the unit of work to be applied to a given chunk of text is defined as my ParserCallable which returns a Payload.
So I have a
List<Future<PayLoad>> list;
which is populated by handing off chunks of work to each ParserCallable.
I want to debug ParserCallable in this multithreaded environment, and I don't have any concern for which one, but I'm not sure how I can step into the execution of any ParserCallable's from my code.
Which looks something like
List<Future<PayLoad>> list = new ArrayList<Future<PayLoad>>();
ExecutorService executor = Executors.newFixedThreadPool(25);
for (int i = 0; i < blocks_of_work.size(); i++) {
Callable<PayLoad> worker = new ParserCallable(blocks_of_work.get(i));
Future<PayLoad> submit = executor.submit(worker);
list.add(submit);
}
How I can debug any given ParserCallable in order to troubleshoot some errors I'm getting? Based on my code I'm not sure how to step into one of these callables.
You need to put a break point in the callable itself.
From a computer science theoretic standpoint, it's possible to enable smooth debugging (after all why does your language care whether the operation was sync or async?) but I don't believe this is supported in any mainstream language, like Java, yet.