8319072: JFR: Turn off events for JFR.view
Reviewed-by: mgronlun
This commit is contained in:
parent
d5f59cf0a8
commit
d2c529cc37
src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd
@ -65,13 +65,15 @@ abstract class AbstractDCmd {
|
||||
// Remember to keep the two sides in synch.
|
||||
public abstract Argument[] getArgumentInfos();
|
||||
|
||||
// Called by native
|
||||
protected abstract void execute(ArgumentParser parser) throws DCmdException;
|
||||
|
||||
|
||||
// Called by native
|
||||
public final String[] execute(String source, String arg, char delimiter) throws DCmdException {
|
||||
this.source = source;
|
||||
if (isInteractive()) {
|
||||
JVM.exclude(Thread.currentThread());
|
||||
}
|
||||
try {
|
||||
boolean log = Logger.shouldLog(LogTag.JFR_DCMD, LogLevel.DEBUG);
|
||||
if (log) {
|
||||
@ -92,9 +94,19 @@ abstract class AbstractDCmd {
|
||||
DCmdException e = new DCmdException(iae.getMessage());
|
||||
e.addSuppressed(iae);
|
||||
throw e;
|
||||
} finally {
|
||||
if (isInteractive()) {
|
||||
JVM.include(Thread.currentThread());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Diagnostic commands that are meant to be used interactively
|
||||
// should turn off events to avoid noise in the output.
|
||||
protected boolean isInteractive() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected final Output getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
@ -71,6 +71,11 @@ public final class DCmdQuery extends AbstractDCmd {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final boolean isInteractive() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private String stripQuotes(String text) {
|
||||
if (text.startsWith("\"")) {
|
||||
text = text.substring(1);
|
||||
|
@ -83,6 +83,11 @@ public class DCmdView extends AbstractDCmd {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final boolean isInteractive() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] printHelp() {
|
||||
List<String> lines = new ArrayList<>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user