Debuggin inside a thread in Intellij Idea

I have the following piece of code :

 private void fireSendMessageRequested(final String messageText)
        final ActiveChatsService activeChatsService = _activeChatsService;
        final ActiveChat activeChat = _activeChat;
        BackgroundTaskService.scheduleTask(new Callable<Void>()
            public Void call() throws Exception
                activeChatsService.sendMessage(activeChat, messageText.trim());
                return null;

Open in new window

I had put debug points on all the lines in Intellij IDEA.
The debugger stops at first line on its execution. Then i press step next. It jumps to next line. But when the debug point reaches the line : BackgroundTaskService.scheduleTask(new Callable<Void>()
Stepping next or pressing force into the debugger never goes inside the call() function.

What could be the reason for this. Is there any way out.

The Debugger works perfect but when there is such a Callable it never goes inside and hangs although there is a breakpoint there. Even pressing multiple times the debugger does not seems to go inside and runs as if there is no debug point.

Rohit BajajAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can't use "step next" to go inside that Callable because it won't be executed right away.  It'll be executed at some later time when the other thread (inside BackgroundTaskService) wakes up and runs the code.

You should however be able to explicitly set a breakpoint inside the call() method and let the program continue running and it'll break inside there when the call() is executed.

If it's not breaking, then I would suspect that the Callable() is never getting executed.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.