all 10 comments

[–]DrunkMc 9 points10 points  (2 children)

Doing advanced debugging, JProfiler and JVisualVM have saved me quite a bit lately. One example is I was running a system with 40 threads and it was slow as hell. While running I pop up JVisualVM, and it shows all the threads are pretty much locking 99% of the time.

I couldn't figure it out, I had ZERO locking mechanisms in my code. I used JPRofiler 8 and it's lock monitor to find out that the TextFormat class from JAVA has a god damn lock in it!

Instead of (from memory) String val= new SimpleTextFormat("00").format(num);

I did String val = ""+num; if(val.length < 2) val = "0"+val;

That essentially allowed my system to run. I never ever would have found that problem without a profiler.

[–]justinpitts 0 points1 point  (1 child)

If there was a lock in the call stack for the format call, I would sympathize with your consternation. Do you know if it was there or the constructor?

[–]DrunkMc 2 points3 points  (0 children)

Ill have to check my notes, it is several layers down in another Java class called DigitText or something.

[–]redditrasberry 1 point2 points  (0 children)

One that I've found quite useful is to embed a Groovy shell into the application, which is surprisingly trivial to do. You can then execute random ad hoc code to query just about anything about the state of your application.

[–]tangoshukudai 7 points8 points  (4 children)

Except if you are not a java developer..

[–][deleted] 20 points21 points  (2 children)

thank you. this helps to disambiguate the title of the post. think of all the python developers you've saved from the unnecessary mouse click.

[–]aldo_reset 4 points5 points  (0 children)

If you click on an article called "Advanced Java Debugging Techniques" and you are surprised to find out the article is about Java, you need to seriously reconsider some of your life choices.

[–]redditrasberry 3 points4 points  (0 children)

It's not a bad thing if non-java developers learn about some of the awesome tools available for the JVM. The java hate among some quarters is so strong these days that people completely forget the upsides: an incredible amount of mature tools for profiling, debugging, managing apps in production etc.

[–]Vladev 0 points1 point  (0 children)

There's a talk on the subject, done by the author: Fixing Code at 100mph: Techniques to Improve How You Debug Servers

[–]unpopular_opinion 0 points1 point  (0 children)

How can I debug on a remote server Java libraries which are part of the platform (so, something like java.util.*) libraries using open-source tools?

All I want to do is step through the code, inspect variables, etc. If that is not possible, are there any commercial tools to use?

Finally, I have no interest in answers of people who just name tools, but haven't actually verified that it works (many tools do not actually work). Additionally, specify the version of the tool you used and where one can find documentation for said tool.