jfr-polyfill

A polyfill for JDK Flight Recorder (JFR) to avoid errors on JDKs that don't support JFR yet

GPL-2.0 License

Stars
8
Committers
8

https://github.com/gradle/jfr-polyfill/blob/master/LICENSE[image:https://img.shields.io/badge/License-GPLv2%20%2B%20Classpath%20exception-blue[License]] https://central.sonatype.com/artifact/org.gradle.jfr.polyfill/jfr-polyfill[image:https://img.shields.io/maven-central/v/org.gradle.jfr.polyfill/jfr-polyfill.svg?label=Maven%20Central[Maven Central]] https://github.com/gradle/jfr-polyfill/actions/workflows/verify.yml[image:https://github.com/gradle/jfr-polyfill/actions/workflows/verify.yml/badge.svg?branch=main[GitHub Workflow Status]]

= JFR Polyfill https://en.wikipedia.org/wiki/JDK_Flight_Recorder[JDK Flight Recorder (JFR)] is a high performance event recorder built into the Java virtual machine. It was open sourced with OpenJDK 11 and then back-ported to OpenJDK 8.

The jfr-polyfill library is a no-op https://en.wikipedia.org/wiki/Polyfill_(programming)[polyfill] implementation of the jdk.jfr.* interfaces and classes. The goal is to enable projects to add JFR events to their codebase without dropping support for old JDKs that don't support JFR. The polyfill will not provide any recordings on unsupported JDKs, but it will prevent ClassNotFoundError.

If you want to know more, read the <<docs/jdk_jfr_support_investigation.adoc#investigation, investigation>> into which JDKs support JFR, and how you can validate your own JDKs.

== Usage Instructions

Just add org.gradle.jfr.polyfill:jfr-polyfill (https://search.maven.org/search?q=g:org.gradle.jfr.polyfill%20AND%20a:jfr-polyfill[latest version]) as a dependency, it will serve as fallback implementation when JFR is not available. If native JFR is available, it is on the boot classpath and will take priority over the polyfill.

== Contributing

This project adheres to the https://gradle.org/conduct/[Gradle Code of Conduct]. By participating, you are expected to uphold this code.