mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8222000: JFR: Process start event
Reviewed-by: mgronlun, rriggs
This commit is contained in:
parent
123ac07064
commit
672992f6ac
10 changed files with 207 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -34,6 +34,8 @@ import java.util.Arrays;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringJoiner;
|
||||
import jdk.internal.event.ProcessStartEvent;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
/**
|
||||
|
@ -1104,11 +1106,23 @@ public final class ProcessBuilder
|
|||
}
|
||||
|
||||
try {
|
||||
return ProcessImpl.start(cmdarray,
|
||||
Process process = ProcessImpl.start(cmdarray,
|
||||
environment,
|
||||
dir,
|
||||
redirects,
|
||||
redirectErrorStream);
|
||||
ProcessStartEvent event = new ProcessStartEvent();
|
||||
if (event.isEnabled()) {
|
||||
StringJoiner command = new StringJoiner(" ");
|
||||
for (String s: cmdarray) {
|
||||
command.add(s);
|
||||
}
|
||||
event.directory = dir;
|
||||
event.command = command.toString();
|
||||
event.pid = process.pid();
|
||||
event.commit();
|
||||
}
|
||||
return process;
|
||||
} catch (IOException | IllegalArgumentException e) {
|
||||
String exceptionInfo = ": " + e.getMessage();
|
||||
Throwable cause = e;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue