= new ArrayList<>(); fields.add(new ValueDescriptor(String.class, "message", singletonList(new AnnotationElement(Label.class, "Message")))); fields.add(new ValueDescriptor(int.class, "number", singletonList(new AnnotationElement(Label.class, "Number")))); List<AnnotationElement> eventAnnotations = new ArrayList<>(); eventAnnotations.add(new AnnotationElement(Name.class, "com.example.HelloWorldEvent")); eventAnnotations.add(new AnnotationElement(Label.class, "Hello World")); eventAnnotations.add(new AnnotationElement(Description.class, "Helps programmer getting started")); eventAnnotations.add(new AnnotationElement(Category.class, new String[]{ "Example", "Getting Started" })); EventFactory f = EventFactory.create(eventAnnotations, fields); Event event = f.newEvent(); event.set(0, "hello, world!"); event.set(1, 4711); event.begin(); // 処理 event.commit(); 21 JDK Flight Recorder (JFR) 動的イベント