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/AbstractEventStream.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.security.AccessControlContext;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.time.Duration;
import java.time.Instant;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Consumer;
import jdk.jfr.Configuration;
import jdk.jfr.EventType;
import jdk.jfr.consumer.EventStream;
import jdk.jfr.consumer.MetadataEvent;
import jdk.jfr.consumer.RecordedEvent;
import jdk.jfr.internal.LogLevel;
import jdk.jfr.internal.LogTag;
import jdk.jfr.internal.Logger;
import jdk.jfr.internal.PlatformRecording;
import jdk.jfr.internal.SecuritySupport;
/*
* Purpose of this class is to simplify the implementation of
* an event stream.
*/
public abstract class AbstractEventStream implements EventStream {
private static final AtomicLong counter = new AtomicLong();
private final Object terminated = new Object();
private final Runnable flushOperation = () -> dispatcher().runFlushActions();
@SuppressWarnings("removal")
private final AccessControlContext accessControllerContext;
private final StreamConfiguration streamConfiguration = new StreamConfiguration();
protected final PlatformRecording recording;
private final List<Configuration> configurations;
private volatile Thread thread;
private Dispatcher dispatcher;
private volatile boolean closed;
private boolean daemon = false;
AbstractEventStream(@SuppressWarnings("removal") AccessControlContext acc, PlatformRecording recording, List<Configuration> configurations) throws IOException {
this.accessControllerContext = Objects.requireNonNull(acc);
this.recording = recording;
this.configurations = configurations;
}
@Override
public abstract void start();
@Override
public abstract void startAsync();
@Override
public abstract void close();
protected final Dispatcher dispatcher() {
if (streamConfiguration.hasChanged()) { // quick check
synchronized (streamConfiguration) {
dispatcher = new Dispatcher(streamConfiguration);
streamConfiguration.setChanged(false);
}
}
return dispatcher;
}
@Override
public final void setOrdered(boolean ordered) {
streamConfiguration.setOrdered(ordered);
}
@Override
public final void setReuse(boolean reuse) {
streamConfiguration.setReuse(reuse);
}
// Only used if -Xlog:jfr+event* is specified
public final void setDaemon(boolean daemon) {
this.daemon = daemon;
}
@Override
public final void setStartTime(Instant startTime) {
Objects.requireNonNull(startTime);
synchronized (streamConfiguration) {
if (streamConfiguration.started) {
throw new IllegalStateException("Stream is already started");
}
if (startTime.isBefore(Instant.EPOCH)) {
startTime = Instant.EPOCH;
}
streamConfiguration.setStartTime(startTime);
}
}
@Override
public final void setEndTime(Instant endTime) {
Objects.requireNonNull(endTime);
synchronized (streamConfiguration) {
if (streamConfiguration.started) {
throw new IllegalStateException("Stream is already started");
}
streamConfiguration.setEndTime(endTime);
}
}
@Override
public final void onEvent(Consumer<RecordedEvent> action) {
Objects.requireNonNull(action);
streamConfiguration.addEventAction(action);
}
@Override
public final void onEvent(String eventName, Consumer<RecordedEvent> action) {
Objects.requireNonNull(eventName);
Objects.requireNonNull(action);
streamConfiguration.addEventAction(eventName, action);
}
@Override
public final void onFlush(Runnable action) {
Objects.requireNonNull(action);
streamConfiguration.addFlushAction(action);
}
@Override
public final void onClose(Runnable action) {
Objects.requireNonNull(action);
streamConfiguration.addCloseAction(action);
}
@Override
public final void onError(Consumer<Throwable> action) {
Objects.requireNonNull(action);
streamConfiguration.addErrorAction(action);
}
@Override
public final boolean remove(Object action) {
Objects.requireNonNull(action);
return streamConfiguration.remove(action);
}
@Override
public final void awaitTermination() throws InterruptedException {
awaitTermination(Duration.ofMillis(0));
}
@Override
public final void awaitTermination(Duration timeout) throws InterruptedException {
Objects.requireNonNull(timeout);
if (timeout.isNegative()) {
throw new IllegalArgumentException("timeout value is negative");
}
long base = System.currentTimeMillis();
long now = 0;
long millis;
try {
millis = Math.multiplyExact(timeout.getSeconds(), 1000);
} catch (ArithmeticException a) {
millis = Long.MAX_VALUE;
}
int nanos = timeout.toNanosPart();
if (nanos == 0 && millis == 0) {
synchronized (terminated) {
while (!isClosed()) {
terminated.wait(0);
}
}
} else {
while (!isClosed()) {
long delay = millis - now;
if (delay <= 0) {
break;
}
synchronized (terminated) {
terminated.wait(delay, nanos);
}
now = System.currentTimeMillis() - base;
}
}
}
protected abstract void process() throws IOException;
protected final void setClosed(boolean closed) {
this.closed = closed;
}
protected final boolean isClosed() {
return closed;
}
public final void startAsync(long startNanos) {
startInternal(startNanos);
Runnable r = () -> run(accessControllerContext);
thread = SecuritySupport.createThreadWitNoPermissions(nextThreadName(), r);
SecuritySupport.setDaemonThread(thread, daemon);
thread.start();
}
public final void start(long startNanos) {
startInternal(startNanos);
thread = Thread.currentThread();
run(accessControllerContext);
}
protected final Runnable getFlushOperation() {
return flushOperation;
}
protected final void onFlush() {
Runnable r = getFlushOperation();
if (r != null) {
r.run();
}
}
private void startInternal(long startNanos) {
synchronized (streamConfiguration) {
if (streamConfiguration.started) {
throw new IllegalStateException("Event stream can only be started once");
}
if (recording != null && streamConfiguration.startTime == null) {
streamConfiguration.setStartNanos(startNanos);
}
streamConfiguration.setStarted(true);
}
}
private void execute() {
try {
process();
} catch (IOException ioe) {
// This can happen if a chunk file is removed, or
// a file is access that has been closed
// This is "normal" behavior for streaming and the
// stream will be closed when this happens.
} finally {
Logger.log(LogTag.JFR_SYSTEM_STREAMING, LogLevel.DEBUG, "Execution of stream ended.");
try {
close();
} finally {
synchronized (terminated) {
terminated.notifyAll();
}
}
}
}
@SuppressWarnings("removal")
private void run(AccessControlContext accessControlContext) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
execute();
return null;
}
}, accessControlContext);
}
private String nextThreadName() {
return "JFR Event Stream " + counter.incrementAndGet();
}
@Override
public void onMetadata(Consumer<MetadataEvent> action) {
Objects.requireNonNull(action);
synchronized (streamConfiguration) {
if (streamConfiguration.started) {
throw new IllegalStateException("Stream is already started");
}
}
streamConfiguration.addMetadataAction(action);
}
protected final void onMetadata(ChunkParser parser) {
if (parser.hasStaleMetadata()) {
if (dispatcher.hasMetadataHandler()) {
List<EventType> ce = parser.getEventTypes();
List<EventType> pe = parser.getPreviousEventTypes();
if (ce != pe) {
MetadataEvent me = JdkJfrConsumer.instance().newMetadataEvent(pe, ce, configurations);
dispatcher.runMetadataActions(me);
}
parser.setStaleMetadata(false);
}
}
}
}
⏎ jdk/jfr/internal/consumer/AbstractEventStream.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, ≈41🔥, 0💬
Popular Posts:
What Is ojdbc7.jar for Oracle 12c R1? ojdbc7.jar for Oracle 12c R1 is the JAR files of ojdbc.jar, JD...
How to run "jarsigner" command from JDK tools.jar file? "jarsigner" command allows you to digitally ...
Provides a simple high-level Http server API, which can be used to build embedded HTTP servers. Both...
JDK 11 jdk.httpserver.jmod is the JMOD file for JDK 11 HTTP Server module. JDK 11 HTTP Server module...
How to download and install javamail-1_2.zip? The JavaMail API is a set of abstract APIs that model ...