@Target(TYPE) @Retention(RUNTIME) @Inherited public @interface Enabled
If an event doesn't have the annotation, then by default the event is enabled.
The following example shows how the Enabled
annotation can be used to create a disabled event. A disabled event will at most have the overhead of an allocation, or none if the runtime JIT compiler is able to eliminate it.
@Name("StopWatch")
@Label("Stop Watch")
@Category("Debugging")
@StackTrace(false)
@Enabled(false)
static public class StopWatchEvent extends Event {
}
public void update() {
StopWatchEvent e = new StopWatchEvent();
e.begin();
...
e.commit();
}
java -XX:StartFlightRecording:StopWatch#enabled=true ...
Modifier and Type | Optional Element | Description |
---|---|---|
boolean |
value |
Returns true if by default the event should be enabled, false otherwise. |
Modifier and Type | Field | Description |
---|---|---|
static final String |
NAME |
Setting name "enabled" , signifies that the event should be recorded. |
static final String NAME
"enabled"
, signifies that the event should be recorded.boolean value
true
if by default the event should be enabled, false
otherwise.true
if by default the event should be enabled by default, false
otherwisetrue
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/jdk.jfr/jdk/jfr/Enabled.html