Module jdk.jfr
Package jdk.jfr

Annotation Type MetadataDefinition

public @interface MetadataDefinition
Meta annotation for defining new types of event metadata.

In the following example, a transaction event is defined with two user-defined annotations, @Severity and @TransactionId.

 @Description("Value between 0 and 100 that indicates severity. 100 is most severe.")
 public @interface Severity {
     int value() default 50;

 @Label("Transaction Id")
 public @interface TransactionId {

 @Label("Transaction Blocked")
 class TransactionBlocked extends Event {
     long transactionId1;

     @Label("Transaction Blocker")
     long transactionId2;
Adding @MetadataDefinition to the declaration of @Severity and @TransactionId ensures the information is saved by Flight Recorder.