Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
JDK 11 jdk.jfr.jmod - JFR Module
JDK 11 jdk.jfr.jmod is the JMOD file for JDK 11 JFR module.
JDK 11 JFR module compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\jdk.jfr.jmod.
JDK 11 JFR module compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.
JDK 11 JFR module source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\jdk.jfr.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/jfr/FlightRecorder.java
/* * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package jdk.jfr; import static jdk.jfr.internal.LogLevel.DEBUG; import static jdk.jfr.internal.LogLevel.INFO; import static jdk.jfr.internal.LogTag.JFR; import java.security.AccessControlContext; import java.security.AccessController; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; import jdk.jfr.internal.JVM; import jdk.jfr.internal.JVMSupport; import jdk.jfr.internal.LogLevel; import jdk.jfr.internal.Logger; import jdk.jfr.internal.MetadataRepository; import jdk.jfr.internal.Options; import jdk.jfr.internal.PlatformRecorder; import jdk.jfr.internal.PlatformRecording; import jdk.jfr.internal.Repository; import jdk.jfr.internal.RequestEngine; import jdk.jfr.internal.Utils; /** * Class for accessing, controlling, and managing Flight Recorder. * <p> * This class provides the methods necessary for creating, starting, stopping, * and destroying recordings. * * @since 9 */ public final class FlightRecorder { private static volatile FlightRecorder platformRecorder; private static volatile boolean initialized; private final PlatformRecorder internal; private FlightRecorder(PlatformRecorder internal) { this.internal = internal; } /** * Returns an immutable list of the available recordings. * <p> * A recording becomes available when it is created. It becomes unavailable when it * is in the {@code CLOSED} state, typically after a call to * {@link Recording#close()}. * * @return a list of recordings, not {@code null} */ public List<Recording> getRecordings() { List<Recording> recs = new ArrayList<>(); for (PlatformRecording r : internal.getRecordings()) { recs.add(r.getRecording()); } return Collections.unmodifiableList(recs); } /** * Creates a snapshot of all available recorded data. * <p> * A snapshot is a synthesized recording in a {@code STOPPPED} state. If no data is * available, a recording with size {@code 0} is returned. * <p> * A snapshot provides stable access to data for later operations (for example, * operations to change the interval or to reduce the data size). * <p> * The following example shows how to create a snapshot and write a subset of the data to a file. * * <pre> * <code> * try (Recording snapshot = FlightRecorder.getFlightRecorder().takeSnapshot()) { * if (snapshot.getSize() > 0) { * snapshot.setMaxSize(100_000_000); * snapshot.setMaxAge(Duration.ofMinutes(5)); * snapshot.dump(Paths.get("snapshot.jfr")); * } * } * </code> * </pre> * * The caller must close the recording when access to the data is no longer * needed. * * @return a snapshot of all available recording data, not {@code null} */ public Recording takeSnapshot() { Recording snapshot = new Recording(); snapshot.setName("Snapshot"); internal.fillWithRecordedData(snapshot.getInternal(), null); return snapshot; } /** * 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); } /** * 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); } /** * Returns the Flight Recorder for the platform. * * @return a Flight Recorder instance, not {@code null} * * @throws IllegalStateException if Flight Recorder can't be created (for * example, if the Java Virtual Machine (JVM) lacks Flight Recorder * support, or if the file repository can't be created or accessed) * * @throws SecurityException if a security manager exists and the caller does * not have {@code FlightRecorderPermission("accessFlightRecorder")} */ public static FlightRecorder getFlightRecorder() throws IllegalStateException, SecurityException { synchronized (PlatformRecorder.class) { Utils.checkAccessFlightRecorder(); JVMSupport.ensureWithIllegalStateException(); if (platformRecorder == null) { try { platformRecorder = new FlightRecorder(new PlatformRecorder()); } catch (IllegalStateException ise) { throw ise; } catch (Exception e) { throw new IllegalStateException("Can't create Flight Recorder. " + e.getMessage(), e); } // Must be in synchronized block to prevent instance leaking out // before initialization is done initialized = true; Logger.log(JFR, INFO, "Flight Recorder initialized"); Logger.log(JFR, DEBUG, "maxchunksize: " + Options.getMaxChunkSize()+ " bytes"); Logger.log(JFR, DEBUG, "memorysize: " + Options.getMemorySize()+ " bytes"); Logger.log(JFR, DEBUG, "globalbuffersize: " + Options.getGlobalBufferSize()+ " bytes"); Logger.log(JFR, DEBUG, "globalbuffercount: " + Options.getGlobalBufferCount()); Logger.log(JFR, DEBUG, "dumppath: " + Options.getDumpPath()); Logger.log(JFR, DEBUG, "samplethreads: " + Options.getSampleThreads()); Logger.log(JFR, DEBUG, "stackdepth: " + Options.getStackDepth()); Logger.log(JFR, DEBUG, "threadbuffersize: " + Options.getThreadBufferSize()); Logger.log(JFR, LogLevel.INFO, "Created repository " + Repository.getRepository().getRepositoryPath().toString()); PlatformRecorder.notifyRecorderInitialized(platformRecorder); } } return platformRecorder; } /** * Adds a hook for a periodic event. * <p> * The implementation of the hook should return as soon as possible, to * avoid blocking other Flight Recorder operations. The hook should emit * one or more events of the specified type. When a hook is added, the * interval at which the call is invoked is configurable using the * {@code "period"} setting. * * @param eventClass the class that the hook should run for, not {@code null} * @param hook the hook, not {@code null} * @throws IllegalArgumentException if a class is not a subclass of * {@link Event}, is abstract, or the hook is already added * @throws IllegalStateException if the event class has the * {@code Registered(false)} annotation and is not registered manually * @throws SecurityException if a security manager exists and the caller * does not have {@code FlightRecorderPermission("registerEvent")} */ public static void addPeriodicEvent(Class<? extends Event> eventClass, Runnable hook) throws SecurityException { Objects.requireNonNull(eventClass); Objects.requireNonNull(hook); if (JVMSupport.isNotAvailable()) { return; } Utils.ensureValidEventSubclass(eventClass); Utils.checkRegisterPermission(); AccessControlContext acc = AccessController.getContext(); RequestEngine.addHook(acc, EventType.getEventType(eventClass).getPlatformEventType(), hook); } /** * Removes a hook for a periodic event. * * @param hook the hook to remove, not {@code null} * @return {@code true} if hook is removed, {@code false} otherwise * @throws SecurityException if a security manager exists and the caller * does not have {@code FlightRecorderPermission("registerEvent")} */ public static boolean removePeriodicEvent(Runnable hook) throws SecurityException { Objects.requireNonNull(hook); Utils.checkRegisterPermission(); if (JVMSupport.isNotAvailable()) { return false; } return RequestEngine.removeHook(hook); } /** * 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()); } /** * Adds a recorder listener and captures the {@code AccessControlContext} to * use when invoking the listener. * <p> * If Flight Recorder is already initialized when the listener is added, then the method * {@link FlightRecorderListener#recorderInitialized(FlightRecorder)} method is * invoked before returning from this method. * * @param changeListener the listener to add, not {@code null} * * @throws SecurityException if a security manager exists and the caller * does not have * {@code FlightRecorderPermission("accessFlightRecorder")} */ public static void addListener(FlightRecorderListener changeListener) { Objects.requireNonNull(changeListener); Utils.checkAccessFlightRecorder(); if (JVMSupport.isNotAvailable()) { return; } PlatformRecorder.addListener(changeListener); } /** * Removes a recorder listener. * <p> * If the same listener is added multiple times, only one instance is * removed. * * @param changeListener listener to remove, not {@code null} * * @throws SecurityException if a security manager exists and the caller * does not have * {@code FlightRecorderPermission("accessFlightRecorder")} * * @return {@code true}, if the listener could be removed, {@code false} * otherwise */ public static boolean removeListener(FlightRecorderListener changeListener) { Objects.requireNonNull(changeListener); Utils.checkAccessFlightRecorder(); if (JVMSupport.isNotAvailable()) { return false; } return PlatformRecorder.removeListener(changeListener); } /** * Returns {@code true} if the Java Virtual Machine (JVM) has Flight Recorder capabilities. * <p> * This method can quickly check whether Flight Recorder can be * initialized, without actually doing the initialization work. The value may * change during runtime and it is not safe to cache it. * * @return {@code true}, if Flight Recorder is available, {@code false} * otherwise * * @see FlightRecorderListener for callback when Flight Recorder is * initialized */ public static boolean isAvailable() { if (JVMSupport.isNotAvailable()) { return false; } return JVM.getJVM().isAvailable(); } /** * Returns {@code true} if Flight Recorder is initialized. * * @return {@code true}, if Flight Recorder is initialized, * {@code false} otherwise * * @see FlightRecorderListener for callback when Flight Recorder is * initialized */ public static boolean isInitialized() { return initialized; } PlatformRecorder getInternal() { return internal; } }
⏎ jdk/jfr/FlightRecorder.java
Or download all of them as a single archive file:
File name: jdk.jfr-11.0.1-src.zip File size: 237632 bytes Release date: 2018-11-04 Download
⇒ JDK 11 jdk.jlink.jmod - JLink Tool
2020-06-30, 37416👍, 0💬
Popular Posts:
How to merge two JAR files with "jar" commands? I am tired of specifying multiple JAR files in the c...
ANTLR is a powerful parser generator for multiple programming languages including Java. ANTLR contai...
How to display types defined in an XML Schema file with the xs\QueryXS.java provided in the Apache X...
How to perform XML Schema validation with dom\Writer.java provided in the Apache Xerces package? You...
JLayer is a library that decodes/plays/converts MPEG 1/2/2.5 Layer 1/2/3 (i.e. MP3) in real time for...