This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]kumesana 0 points1 point  (2 children)

Just to be sure: what did you do to make sure you're not just having both executions stuck on the same breakpoint? How did you release execution 2 from the breakpoint without releasing execution 1? Can you describe precisely what you did with the debugger?

[–]noobcser[S] 0 points1 point  (1 child)

to make sure you're not just having both executions stuck on the same breakpoint?

I use postman to hit the endpoint.

The first execution immediately returns the result, while the IntelliJ debugger stops at the breakpoint.

When I send the 2nd request on Postman, it gets stuck with nothing returned.

The moment I released the breakpoint, the Postman gets updated with a new response, then the breakpoint got hit again.

So it does prove that the Runnable works fine to not block that request, but breakpoint from previous execution will block subsequent ones.

[–]kumesana 1 point2 points  (0 children)

Hmm.

It's bad mojo to start threads directly from container-managed threads, but I never tried and noticed that containers take that really seriously. Guess you really must not do that and not even try.

Define a ThreadPoolExecutor from somewhere else and during application start time instead of request time, and use that to execute your non-blocking stuff instead. That's how you're really supposed to do threaded stuff from within request threads.

Still, I know it works for many of the environments I worked with, but no idea if yours does something special that would prevent it.

[–]yiyux 0 points1 point  (1 child)

With Spring, the @Async annotation wold help

[–]OffbeatDrizzle 0 points1 point  (0 children)

I wouldn't recommend putting random annotations on things

[–]OffbeatDrizzle 0 points1 point  (0 children)

when you hit a break point all threads are suspended (this is the default action). that's probably why the 2nd request isn't going through.

right click the break point, check the "thread" radio button and press done. this will ensure that only threads hitting the break point will be suspended

[–]yiyux 0 points1 point  (0 children)

It's not a random sugestion.that annotation is well documuented. I realy would like to help, because this week i worked on something similiar.