|
@@ -119,7 +119,7 @@ public class ProfileServlet extends HttpServlet {
|
|
Pattern.compile(FILE_PREFIX + "[0-9]+-[0-9A-Za-z\\-_]+-[0-9]+\\.[a-z]+");
|
|
Pattern.compile(FILE_PREFIX + "[0-9]+-[0-9A-Za-z\\-_]+-[0-9]+\\.[a-z]+");
|
|
|
|
|
|
private Lock profilerLock = new ReentrantLock();
|
|
private Lock profilerLock = new ReentrantLock();
|
|
- private Integer pid;
|
|
|
|
|
|
+ private final Integer pid;
|
|
private String asyncProfilerHome;
|
|
private String asyncProfilerHome;
|
|
private transient Process process;
|
|
private transient Process process;
|
|
|
|
|
|
@@ -208,11 +208,11 @@ public class ProfileServlet extends HttpServlet {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
// if pid is explicitly specified, use it else default to current process
|
|
// if pid is explicitly specified, use it else default to current process
|
|
- pid = getInteger(req, "pid", pid);
|
|
|
|
|
|
+ Integer processId = getInteger(req, "pid", pid);
|
|
|
|
|
|
// if pid is not specified in query param and if current process pid
|
|
// if pid is not specified in query param and if current process pid
|
|
// cannot be determined
|
|
// cannot be determined
|
|
- if (pid == null) {
|
|
|
|
|
|
+ if (processId == null) {
|
|
resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
|
resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
|
setResponseHeader(resp);
|
|
setResponseHeader(resp);
|
|
resp.getWriter().write(
|
|
resp.getWriter().write(
|
|
@@ -243,7 +243,7 @@ public class ProfileServlet extends HttpServlet {
|
|
//Should be in sync with FILE_NAME_PATTERN
|
|
//Should be in sync with FILE_NAME_PATTERN
|
|
File outputFile =
|
|
File outputFile =
|
|
OUTPUT_DIR.resolve(
|
|
OUTPUT_DIR.resolve(
|
|
- ProfileServlet.generateFileName(pid, output, event))
|
|
|
|
|
|
+ ProfileServlet.generateFileName(processId, output, event))
|
|
.toFile();
|
|
.toFile();
|
|
List<String> cmd = new ArrayList<>();
|
|
List<String> cmd = new ArrayList<>();
|
|
cmd.add(asyncProfilerHome + PROFILER_SCRIPT);
|
|
cmd.add(asyncProfilerHome + PROFILER_SCRIPT);
|
|
@@ -288,7 +288,7 @@ public class ProfileServlet extends HttpServlet {
|
|
if (reverse) {
|
|
if (reverse) {
|
|
cmd.add("--reverse");
|
|
cmd.add("--reverse");
|
|
}
|
|
}
|
|
- cmd.add(pid.toString());
|
|
|
|
|
|
+ cmd.add(processId.toString());
|
|
process = runCmdAsync(cmd);
|
|
process = runCmdAsync(cmd);
|
|
|
|
|
|
// set response and set refresh header to output location
|
|
// set response and set refresh header to output location
|