Last updated on 3/4/20
Fix Bugs Using Additional Java Debugging Tools and Techniques
- Fix bugs using Visual VM, JConsole, and Logging techniques
A quiz covering the use of VisualVM, JConsole, and the SLF4J logging facade to observe and gain insights into a running Java application. Skill: Using other Java profilers, JMX, clients, and loggers to observe and investigate applications.
You're working on a Block World video game written in Java and have been called in to help your colleague find out which of the 28,302 methods in this application has suddenly slowed down its render time. Everyone has had a go. Which of the following approaches would be best to apply to quickly help your colleague?
Instrument each method with logging. Log when they were called and work out which methods are slow.
Instrument each method with measurements of their duration and log this!
Reproduce the slow scenario in the debugger and put a breakpoint before and after each suspect method, measuring how long it takes to run.
Look at all the commits added to the production branch and perform a binary search until you find the culprit.
Use a profiling tool such as VisualVM to profile a slow run of your program and have VisualVM show you all of its hot spots.
The magical application for estimating Dragon Saddle Sizes has slowed down, again! You profile it in VisualVM and are presented with thisHot Spots view from VisualVM:
Which of the following can you infer from the table above?
The single slowest method which has slowed down this application is
com.openclassrooms.debugging.DragonSaddleSizeGuesser.main(String). It has a total time of 7,795 seconds!
com.openclassrooms.debugging.DragonSaddleSizeGuesser.main(String)is the first method called. It takes as long as the application takes to run but is not the method slowing down this application.
com.openclassrooms.debugging.DragonSaddleSizeEstimator.calculateTheUltimateAnswer()is the method slowing down this application. It takes 2,294+7785 ms of the total time of the application!
com.openclassrooms.debugging.DragonSaddleSizeEstimator.enterAProgrammaticTrance()takes 5,490 milliseconds to run in total. It accounts for 70.4% of the total time of the application. This would make a great candidate to investigate.
Which of the following describes the purpose of Java Management Extensions?Careful, there are several correct answers.
They are used for reporting costs to your company's management.
They make your Java applications extensible at runtime using a special dynamic
classloaderto hot-load classes.
They are a standard for monitoring metrics and reporting information from running Java applications.
They are a standard for application developers to provide special application management endpoints within their software, by creating special classes called MBeans.
They are a standard for managing and reconfiguring running Java applications at runtime.