143. Monitoring deserialization via JFR
Java Flight Recorder (JFR) is an event-based tool for the diagnosis and profiling of Java applications. This tool was initially added in JDK 7 and, since then, it has been constantly improved. For instance, in JDK 14, JFR was enriched with event streaming, and in JDK 19, with filtering event capabilities, and so on. You can find all JFR events listed and documented per JDK version at https://sap.github.io/SapMachine/jfrevents/.
Among its rich list of events, JFR can monitor and record deserialization events (the deserialization event). Let’s assume a simple application like the one from Problem 131 (the first problem of this chapter). We start configuring JFR for monitoring the deserialization of this application by adding deserializationEvent.jfc
into the root folder of the application:
<?xml version="1.0" encoding="UTF-8"?>
<configuration version="2.0" description="test">
...