简体   繁体   中英

java program execution is suspended and I cannot step into

I am working in a project in Eclipse which uses an ExecutorService class. Well I am not familiar with multithreading or concurrency but the problem I am facing is that when I am debugging I cannot proceed to the next method by using step into (F5). To be more specific I put a breakpoint in:

pool.awaitTermination(TERMINATION_TIMEOUT, TimeUnit.DAYS);

and I cannot proceed any further. The execution is suspended and if a unsupened (by pressing the suspend button) it stops to Unsafe.park(boolean, long) which is of java and I cannot see the code. There I cannot seem to be able to proceed any further using unsuspend or step into. The really annoying is that I can proceed using resume (F8) which leads me to the next breakpoint just like nothing happened. If it's of any use the arguments seems to be TERMINATION_TIMEOUT = 100 , TimeUnit.DAYS=6 .

I have seen other posts and I am guessing that an exception was thrown ( ThreadPoolExecutor maybe) but the proposed solutions did not work for me or I did not manage to apply them.

Anyway any idea how can I overcome this issue?

Instead of setting breakpoint on the pool, why not set that on the Runnable instances you have put into the ExecutorService ?

If you cannot do this due to various places for submitting such Runnable s, you can simply Write a Runnable wrapper wrapping the real task and catch any exceptions thrown; then subclassing the Executor you use to actually run such an exception catching Runnable wrapper. Thus you can get all the exceptions you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM