Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
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 (322)
Collections:
Other Resources:
JDK 17 jdk.jfr.jmod - JFR Module
JDK 17 jdk.jfr.jmod is the JMOD file for JDK 17 JFR module.
JDK 17 JFR module compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\jdk.jfr.jmod.
JDK 17 JFR module compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 JFR module source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\jdk.jfr.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/jfr/internal/consumer/EventDirectoryStream.java
/*
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package jdk.jfr.internal.consumer;
import java.io.IOException;
import java.nio.file.Path;
import java.security.AccessControlContext;
import java.time.Duration;
import java.time.Instant;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.function.Consumer;
import jdk.jfr.Configuration;
import jdk.jfr.consumer.RecordedEvent;
import jdk.jfr.internal.JVM;
import jdk.jfr.internal.PlatformRecording;
import jdk.jfr.internal.SecuritySupport;
import jdk.jfr.internal.Utils;
import jdk.jfr.internal.consumer.ChunkParser.ParserConfiguration;
/**
* Implementation of an {@code EventStream}} that operates against a directory
* with chunk files.
*
*/
public class EventDirectoryStream extends AbstractEventStream {
private static final Comparator<? super RecordedEvent> EVENT_COMPARATOR = JdkJfrConsumer.instance().eventComparator();
private final RepositoryFiles repositoryFiles;
private final FileAccess fileAccess;
private ChunkParser currentParser;
private long currentChunkStartNanos;
private RecordedEvent[] sortedCache;
private int threadExclusionLevel = 0;
protected volatile long maxSize;
protected volatile Duration maxAge;
private volatile Consumer<Long> onCompleteHandler;
public EventDirectoryStream(
@SuppressWarnings("removal")
AccessControlContext acc,
Path p,
FileAccess fileAccess,
PlatformRecording recording,
List<Configuration> configurations,
boolean allowSubDirectories) throws IOException {
super(acc, recording, configurations);
if (p != null && SecuritySupport.PRIVILEGED == fileAccess) {
throw new SecurityException("Priviliged file access not allowed with potentially malicious Path implementation");
}
this.fileAccess = Objects.requireNonNull(fileAccess);
this.repositoryFiles = new RepositoryFiles(fileAccess, p, allowSubDirectories);
}
@Override
public void close() {
setClosed(true);
dispatcher().runCloseActions();
repositoryFiles.close();
if (currentParser != null) {
currentParser.close();
onComplete(currentParser.getEndNanos());
}
}
public void setChunkCompleteHandler(Consumer<Long> handler) {
onCompleteHandler = handler;
}
private void onComplete(long epochNanos) {
Consumer<Long> handler = onCompleteHandler;
if (handler != null) {
handler.accept(epochNanos);
}
}
@Override
public void start() {
start(Utils.timeToNanos(Instant.now()));
}
@Override
public void startAsync() {
startAsync(Utils.timeToNanos(Instant.now()));
}
@Override
protected void process() throws IOException {
JVM jvm = JVM.getJVM();
Thread t = Thread.currentThread();
try {
if (jvm.isExcluded(t)) {
threadExclusionLevel++;
} else {
jvm.exclude(t);
}
processRecursionSafe();
} finally {
if (threadExclusionLevel > 0) {
threadExclusionLevel--;
} else {
jvm.include(t);
}
}
}
protected void processRecursionSafe() throws IOException {
Dispatcher lastDisp = null;
Dispatcher disp = dispatcher();
Path path;
boolean validStartTime = recording != null || disp.startTime != null;
if (validStartTime) {
path = repositoryFiles.firstPath(disp.startNanos, true);
} else {
path = repositoryFiles.lastPath(true);
}
if (path == null) { // closed
return;
}
currentChunkStartNanos = repositoryFiles.getTimestamp(path);
try (RecordingInput input = new RecordingInput(path.toFile(), fileAccess)) {
input.setStreamed();
currentParser = new ChunkParser(input, disp.parserConfiguration);
long segmentStart = currentParser.getStartNanos() + currentParser.getChunkDuration();
long filterStart = validStartTime ? disp.startNanos : segmentStart;
long filterEnd = disp.endTime != null ? disp.endNanos : Long.MAX_VALUE;
while (!isClosed()) {
onMetadata(currentParser);
while (!isClosed() && !currentParser.isChunkFinished()) {
disp = dispatcher();
if (disp != lastDisp) {
ParserConfiguration pc = disp.parserConfiguration;
pc.filterStart = filterStart;
pc.filterEnd = filterEnd;
currentParser.updateConfiguration(pc, true);
lastDisp = disp;
}
if (disp.parserConfiguration.isOrdered()) {
processOrdered(disp);
} else {
processUnordered(disp);
}
currentParser.resetCache();
if (currentParser.getStartNanos() + currentParser.getChunkDuration() > filterEnd) {
close();
return;
}
}
if (isLastChunk()) {
// Recording was stopped/closed externally, and no more data to process.
return;
}
if (repositoryFiles.hasFixedPath() && currentParser.isFinalChunk()) {
// JVM process exited/crashed, or repository migrated to an unknown location
return;
}
if (isClosed()) {
// Stream was closed
return;
}
long durationNanos = currentParser.getChunkDuration();
long endChunkNanos = currentParser.getEndNanos();
if (durationNanos == 0) {
// Avoid reading the same chunk again and again if
// duration is 0 ns
durationNanos++;
}
path = repositoryFiles.nextPath(currentChunkStartNanos + durationNanos, true);
if (path == null) {
return; // stream closed
}
currentChunkStartNanos = repositoryFiles.getTimestamp(path);
input.setFile(path);
onComplete(endChunkNanos);
currentParser = currentParser.newChunkParser();
// TODO: Optimization. No need filter when we reach new chunk
// Could set start = 0;
}
}
}
private boolean isLastChunk() {
if (recording == null) {
return false;
}
return recording.getFinalChunkStartNanos() >= currentParser.getStartNanos();
}
private void processOrdered(Dispatcher c) throws IOException {
if (sortedCache == null) {
sortedCache = new RecordedEvent[100_000];
}
int index = 0;
while (true) {
RecordedEvent e = currentParser.readStreamingEvent();
if (e == null) {
break;
}
if (index == sortedCache.length) {
sortedCache = Arrays.copyOf(sortedCache, sortedCache.length * 2);
}
sortedCache[index++] = e;
}
onMetadata(currentParser);
// no events found
if (index == 0 && currentParser.isChunkFinished()) {
onFlush();
return;
}
// at least 2 events, sort them
if (index > 1) {
Arrays.sort(sortedCache, 0, index, EVENT_COMPARATOR);
}
for (int i = 0; i < index; i++) {
c.dispatch(sortedCache[i]);
}
onFlush();
return;
}
private boolean processUnordered(Dispatcher c) throws IOException {
while (true) {
RecordedEvent e = currentParser.readStreamingEvent();
if (e == null) {
onFlush();
return true;
}
onMetadata(currentParser);
c.dispatch(e);
}
}
public void setMaxSize(long maxSize) {
this.maxSize = maxSize;
}
public void setMaxAge(Duration maxAge) {
this.maxAge = maxAge;
}
}
⏎ jdk/jfr/internal/consumer/EventDirectoryStream.java
Or download all of them as a single archive file:
File name: jdk.jfr-17.0.5-src.zip File size: 363343 bytes Release date: 2022-09-13 Download
⇒ JDK 17 jdk.jlink.jmod - JLink Tool
2023-04-17, ≈58🔥, 0💬
Popular Posts:
What Is mail.jar of JavaMail 1.4.2? I got the JAR file from javamail-1.4.2.zip. mail.jar in javamail...
SLF4J API is a simple API that allows to plug in any desired logging library at deployment time. Her...
JDK 17 jdk.jlink.jmod is the JMOD file for JDK 17 JLink tool, which can be invoked by the "jlink" co...
What Is poi-ooxml-5.2.3.jar? poi-ooxml-5.2.3.jar is one of the JAR files for Apache POI 5.2.3, which...
Where to find answers to frequently asked questions on Downloading and Installing ojdbc.jar - JDBC D...