r/java • • Aug 03 '25

Teach Me the Craziest, Most Useful Java Features — NOT the Basic Stuff

I want to know the WILD, INSANELY PRACTICAL, "how the hell did I not know this earlier?" kind of Java stuff that only real devs who've been through production hell know.

Like I didn't know about modules recently

393 Upvotes

279 comments sorted by

View all comments

130

u/Scf37 Aug 03 '25

Remote debugging. It IS possible to attach your IDEA to deployed application and debug specific request step-by-step exactly as with local run. It is not much harder than JMX setup.

12

u/kubelke Aug 03 '25

Does it block the whole app (and all other requests) when you hit a breakpoint?

32

u/ShadowPengyn Aug 03 '25

Depends. In IntelliJ click on the breakpoint and there is an option to block the thread or the whole application, default ist whole application, but there is a button to change the default as well.

10

u/Moon-In-June_767 Aug 03 '25

When defining a breakpoint you can choose whether to stop the entire app or just the single thread that hit it.

1

u/wildjokers Aug 03 '25

Other people can hit your breakpoints.

1

u/blackkkmamba Aug 03 '25

Yes it does. Don’t do it in production

14

u/Nalha_Saldana Aug 03 '25

It doesn't have to but still not a good idea to do in prod.

5

u/kingslayyer Aug 03 '25

we take the instance out of rotation, do this and put it back if required

22

u/Flat-War4343 Aug 03 '25

For that the remote application should be running on debug mode.

2

u/bfffca Aug 03 '25

It's kind of a basic feature though. How would you debug prod without that otherwise (:D)? 

2

u/ShakesTheClown23 Aug 03 '25

Eclipse has this feature too FYI

1

u/yektadev Aug 03 '25

Sounds scary

1

u/RevilTS Aug 04 '25

I have don this before in eclipse.

1

u/Fine_Journalist6565 Aug 04 '25

Its basically the only way to debug deployed war files running on an application server right?

1

u/on_the_comeup Aug 06 '25

Always fun to do this K8s, forget to disable the health check, and then the pod restarts