jdk.jfr.internal.MetadataRepository Java Examples

The following examples show how to use jdk.jfr.internal.MetadataRepository. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ManagementSupport.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static List<EventType> getEventTypes() {
    // would normally be checked when a Flight Recorder instance is created
    Utils.checkAccessFlightRecorder();
    if (JVMSupport.isNotAvailable()) {
        return new ArrayList<>();
    }
    JDKEvents.initialize(); // make sure JDK events are available
    return Collections.unmodifiableList(MetadataRepository.getInstance().getRegisteredEventTypes());
}
 
Example #2
Source File: ManagementSupport.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static List<EventType> getEventTypes() {
    // would normally be checked when a Flight Recorder instance is created
    Utils.checkAccessFlightRecorder();
    if (JVMSupport.isNotAvailable()) {
        return new ArrayList<>();
    }
    JDKEvents.initialize(); // make sure JDK events are available
    return Collections.unmodifiableList(MetadataRepository.getInstance().getRegisteredEventTypes());
}
 
Example #3
Source File: ManagementSupport.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static List<EventType> getEventTypes() {
    // would normally be checked when a Flight Recorder instance is created
    Utils.checkAccessFlightRecorder();
    if (JVMSupport.isNotAvailable()) {
        return new ArrayList<>();
    }
    JDKEvents.initialize(); // make sure JDK events are available
    return Collections.unmodifiableList(MetadataRepository.getInstance().getRegisteredEventTypes());
}
 
Example #4
Source File: FlightRecorder.java    From dragonwell8_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Unregisters an event class.
 * <p>
 * If the event class is not registered, then the invocation of this method is
 * ignored.
 *
 * @param eventClass the event class to unregistered, not {@code null}
 * @throws IllegalArgumentException if a class is abstract or not a subclass
 *         of {@link Event}
 *
 * @throws SecurityException if a security manager exists and the caller
 *         does not have {@code FlightRecorderPermission("registerEvent")}
 */
public static void unregister(Class<? extends Event> eventClass) {
    Objects.requireNonNull(eventClass);
    if (JVMSupport.isNotAvailable()) {
        return;
    }
    Utils.ensureValidEventSubclass(eventClass);
    MetadataRepository.getInstance().unregister(eventClass);
}
 
Example #5
Source File: EventType.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the event type for an event class, or {@code null} if it doesn't
 * exist.
 *
 * @param eventClass the event class, not {@code null}
 * @return the event class, or null if class doesn't exist
 *
 * @throws IllegalArgumentException if {@code eventClass} is an abstract class
 *
 * @throws IllegalStateException if the class is annotated with
 *         {@code Registered(false)}, but not manually registered
 */
public static EventType getEventType(Class<? extends Event> eventClass) {
    Objects.requireNonNull(eventClass);
    Utils.ensureValidEventSubclass(eventClass);
    JVMSupport.ensureWithInternalError();
    return MetadataRepository.getInstance().getEventType(eventClass);
}
 
Example #6
Source File: FlightRecorder.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Unregisters an event class.
 * <p>
 * If the event class is not registered, then the invocation of this method is
 * ignored.
 *
 * @param eventClass the event class to unregistered, not {@code null}
 * @throws IllegalArgumentException if a class is abstract or not a subclass
 *         of {@link Event}
 *
 * @throws SecurityException if a security manager exists and the caller
 *         does not have {@code FlightRecorderPermission("registerEvent")}
 */
public static void unregister(Class<? extends Event> eventClass) {
    Objects.requireNonNull(eventClass);
    if (JVMSupport.isNotAvailable()) {
        return;
    }
    Utils.ensureValidEventSubclass(eventClass);
    MetadataRepository.getInstance().unregister(eventClass);
}
 
Example #7
Source File: FlightRecorder.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Registers an event class.
 * <p>
 * If the event class is already registered, then the invocation of this method is
 * ignored.
 *
 * @param eventClass the event class to register, not {@code null}
 *
 * @throws IllegalArgumentException if class is abstract or not a subclass
 *         of {@link Event}
 * @throws SecurityException if a security manager exists and the caller
 *         does not have {@code FlightRecorderPermission("registerEvent")}
 */
public static void register(Class<? extends Event> eventClass) {
    Objects.requireNonNull(eventClass);
    if (JVMSupport.isNotAvailable()) {
        return;
    }
    Utils.ensureValidEventSubclass(eventClass);
    MetadataRepository.getInstance().register(eventClass);
}
 
Example #8
Source File: EventType.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the event type for an event class, or {@code null} if it doesn't
 * exist.
 *
 * @param eventClass the event class, not {@code null}
 * @return the event class, or null if class doesn't exist
 *
 * @throws IllegalArgumentException if {@code eventClass} is an abstract class
 *
 * @throws IllegalStateException if the class is annotated with
 *         {@code Registered(false)}, but not manually registered
 */
public static EventType getEventType(Class<? extends Event> eventClass) {
    Objects.requireNonNull(eventClass);
    Utils.ensureValidEventSubclass(eventClass);
    JVMSupport.ensureWithInternalError();
    return MetadataRepository.getInstance().getEventType(eventClass);
}
 
Example #9
Source File: FlightRecorder.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Unregisters an event class.
 * <p>
 * If the event class is not registered, then the invocation of this method is
 * ignored.
 *
 * @param eventClass the event class to unregistered, not {@code null}
 * @throws IllegalArgumentException if a class is abstract or not a subclass
 *         of {@link Event}
 *
 * @throws SecurityException if a security manager exists and the caller
 *         does not have {@code FlightRecorderPermission("registerEvent")}
 */
public static void unregister(Class<? extends Event> eventClass) {
    Objects.requireNonNull(eventClass);
    if (JVMSupport.isNotAvailable()) {
        return;
    }
    Utils.ensureValidEventSubclass(eventClass);
    MetadataRepository.getInstance().unregister(eventClass);
}
 
Example #10
Source File: FlightRecorder.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Registers an event class.
 * <p>
 * If the event class is already registered, then the invocation of this method is
 * ignored.
 *
 * @param eventClass the event class to register, not {@code null}
 *
 * @throws IllegalArgumentException if class is abstract or not a subclass
 *         of {@link Event}
 * @throws SecurityException if a security manager exists and the caller
 *         does not have {@code FlightRecorderPermission("registerEvent")}
 */
public static void register(Class<? extends Event> eventClass) {
    Objects.requireNonNull(eventClass);
    if (JVMSupport.isNotAvailable()) {
        return;
    }
    Utils.ensureValidEventSubclass(eventClass);
    MetadataRepository.getInstance().register(eventClass);
}
 
Example #11
Source File: EventType.java    From dragonwell8_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the event type for an event class, or {@code null} if it doesn't
 * exist.
 *
 * @param eventClass the event class, not {@code null}
 * @return the event class, or null if class doesn't exist
 *
 * @throws IllegalArgumentException if {@code eventClass} is an abstract class
 *
 * @throws IllegalStateException if the class is annotated with
 *         {@code Registered(false)}, but not manually registered
 */
public static EventType getEventType(Class<? extends Event> eventClass) {
    Objects.requireNonNull(eventClass);
    Utils.ensureValidEventSubclass(eventClass);
    JVMSupport.ensureWithInternalError();
    return MetadataRepository.getInstance().getEventType(eventClass);
}
 
Example #12
Source File: FlightRecorder.java    From dragonwell8_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Registers an event class.
 * <p>
 * If the event class is already registered, then the invocation of this method is
 * ignored.
 *
 * @param eventClass the event class to register, not {@code null}
 *
 * @throws IllegalArgumentException if class is abstract or not a subclass
 *         of {@link Event}
 * @throws SecurityException if a security manager exists and the caller
 *         does not have {@code FlightRecorderPermission("registerEvent")}
 */
public static void register(Class<? extends Event> eventClass) {
    Objects.requireNonNull(eventClass);
    if (JVMSupport.isNotAvailable()) {
        return;
    }
    Utils.ensureValidEventSubclass(eventClass);
    MetadataRepository.getInstance().register(eventClass);
}
 
Example #13
Source File: FlightRecorder.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns an immutable list that contains all currently registered events.
 * <p>
 * By default, events are registered when they are first used, typically
 * when an event object is allocated. To ensure an event is visible early,
 * registration can be triggered by invoking the
 * {@link FlightRecorder#register(Class)} method.
 *
 * @return list of events, not {@code null}
 */
public List<EventType> getEventTypes() {
    return Collections.unmodifiableList(MetadataRepository.getInstance().getRegisteredEventTypes());
}
 
Example #14
Source File: EventFactory.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Registers an unregistered event.
 * <p>
 * By default, the event class associated with this event factory is registered
 * when the event factory is created, unless the event has the
 * {@link Registered} annotation.
 * <p>
 * A registered event class can write data to Flight Recorder and event metadata
 * can be obtained by invoking {@link FlightRecorder#getEventTypes()}.
 * <p>
 * If the event class associated with this event factory is already registered,
 * the call to this method is ignored.
 *
 * @throws SecurityException if a security manager exists and the caller
 *         does not have {@code FlightRecorderPermission("registerEvent")}
 * @see Registered
 * @see FlightRecorder#register(Class)
 */
public void register() {
    MetadataRepository.getInstance().register(eventClass, sanitizedAnnotation, sanitizedFields);
}
 
Example #15
Source File: EventFactory.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Unregisters the event that is associated with this event factory.
 * <p>
 * A unregistered event class can't write data to Flight Recorder and event
 * metadata can't be obtained by invoking
 * {@link FlightRecorder#getEventTypes()}.
 * <p>
 * If the event class associated with this event factory is not already
 * registered, the call to this method is ignored.
 *
 * @throws SecurityException if a security manager exists and the caller does
 *         not have {@code FlightRecorderPermission("registerEvent")}
 * @see Registered
 * @see FlightRecorder#unregister(Class)
 */
public void unregister() {
    MetadataRepository.getInstance().unregister(eventClass);
}
 
Example #16
Source File: EventFactory.java    From dragonwell8_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Unregisters the event that is associated with this event factory.
 * <p>
 * A unregistered event class can't write data to Flight Recorder and event
 * metadata can't be obtained by invoking
 * {@link FlightRecorder#getEventTypes()}.
 * <p>
 * If the event class associated with this event factory is not already
 * registered, the call to this method is ignored.
 *
 * @throws SecurityException if a security manager exists and the caller does
 *         not have {@code FlightRecorderPermission("registerEvent")}
 * @see Registered
 * @see FlightRecorder#unregister(Class)
 */
public void unregister() {
    MetadataRepository.getInstance().unregister(eventClass);
}
 
Example #17
Source File: EventFactory.java    From dragonwell8_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Registers an unregistered event.
 * <p>
 * By default, the event class associated with this event factory is registered
 * when the event factory is created, unless the event has the
 * {@link Registered} annotation.
 * <p>
 * A registered event class can write data to Flight Recorder and event metadata
 * can be obtained by invoking {@link FlightRecorder#getEventTypes()}.
 * <p>
 * If the event class associated with this event factory is already registered,
 * the call to this method is ignored.
 *
 * @throws SecurityException if a security manager exists and the caller
 *         does not have {@code FlightRecorderPermission("registerEvent")}
 * @see Registered
 * @see FlightRecorder#register(Class)
 */
public void register() {
    MetadataRepository.getInstance().register(eventClass, sanitizedAnnotation, sanitizedFields);
}
 
Example #18
Source File: FlightRecorder.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns an immutable list that contains all currently registered events.
 * <p>
 * By default, events are registered when they are first used, typically
 * when an event object is allocated. To ensure an event is visible early,
 * registration can be triggered by invoking the
 * {@link FlightRecorder#register(Class)} method.
 *
 * @return list of events, not {@code null}
 */
public List<EventType> getEventTypes() {
    return Collections.unmodifiableList(MetadataRepository.getInstance().getRegisteredEventTypes());
}
 
Example #19
Source File: EventFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Registers an unregistered event.
 * <p>
 * By default, the event class associated with this event factory is registered
 * when the event factory is created, unless the event has the
 * {@link Registered} annotation.
 * <p>
 * A registered event class can write data to Flight Recorder and event metadata
 * can be obtained by invoking {@link FlightRecorder#getEventTypes()}.
 * <p>
 * If the event class associated with this event factory is already registered,
 * the call to this method is ignored.
 *
 * @throws SecurityException if a security manager exists and the caller
 *         does not have {@code FlightRecorderPermission("registerEvent")}
 * @see Registered
 * @see FlightRecorder#register(Class)
 */
public void register() {
    MetadataRepository.getInstance().register(eventClass, sanitizedAnnotation, sanitizedFields);
}
 
Example #20
Source File: EventFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Unregisters the event that is associated with this event factory.
 * <p>
 * A unregistered event class can't write data to Flight Recorder and event
 * metadata can't be obtained by invoking
 * {@link FlightRecorder#getEventTypes()}.
 * <p>
 * If the event class associated with this event factory is not already
 * registered, the call to this method is ignored.
 *
 * @throws SecurityException if a security manager exists and the caller does
 *         not have {@code FlightRecorderPermission("registerEvent")}
 * @see Registered
 * @see FlightRecorder#unregister(Class)
 */
public void unregister() {
    MetadataRepository.getInstance().unregister(eventClass);
}
 
Example #21
Source File: FlightRecorder.java    From dragonwell8_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns an immutable list that contains all currently registered events.
 *
 * By default, events are registered when they are first used, typically
 * when an event object is allocated. To ensure an event is visible early,
 * registration can be triggered by invoking the
 * {@link FlightRecorder#register(Class)} method.
 *
 * @return list of events, not {@code null}
 */
public List<EventType> getEventTypes() {
    return Collections.unmodifiableList(MetadataRepository.getInstance().getRegisteredEventTypes());
}