jdk.jfr.internal.WriteableUserPath Java Examples
The following examples show how to use
jdk.jfr.internal.WriteableUserPath.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DCmdDump.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Execute JFR.dump. * * @param recordingText name or id of the recording to dump, or * <code>null</code> * * @param textPath file path where recording should be written. * * @return result output * * @throws DCmdException if the dump could not be completed */ public String execute(String recordingText, String textPath, Boolean pathToGcRoots) throws DCmdException { if (textPath == null) { throw new DCmdException("Failed to dump %s, missing filename.", recordingText); } Recording recording = findRecording(recordingText); try { SafePath dumpFile = resolvePath(textPath, "Failed to dump %s"); // create file for JVM Utils.touch(dumpFile.toPath()); PlatformRecording r = PrivateAccess.getInstance().getPlatformRecording(recording); WriteableUserPath wup = new WriteableUserPath(dumpFile.toPath()); Map<String, String> overlay = new HashMap<>(); Utils.updateSettingPathToGcRoots(overlay, pathToGcRoots); r.copyTo(wup, "Dumped by user", overlay); reportOperationComplete("Dumped", recording, dumpFile); } catch (IOException | InvalidPathException e) { throw new DCmdException("Failed to dump %s. Could not copy recording for dump. %s", recordingText, e.getMessage()); } return getResult(); }
Example #2
Source File: DCmdDump.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void dump(PlatformRecorder recorder, Recording recording, String name, String filename, Long maxSize, Boolean pathToGcRoots, Instant beginTime, Instant endTime) throws DCmdException { try (PlatformRecording r = newSnapShot(recorder, recording, pathToGcRoots)) { r.filter(beginTime, endTime, maxSize); if (r.getChunks().isEmpty()) { throw new DCmdException("Dump failed. No data found in the specified interval."); } SafePath dumpFile = resolvePath(recording, filename); // Needed for JVM Utils.touch(dumpFile.toPath()); r.dumpStopped(new WriteableUserPath(dumpFile.toPath())); reportOperationComplete("Dumped", name, dumpFile); } catch (IOException | InvalidPathException e) { throw new DCmdException("Dump failed. Could not copy recording data. %s", e.getMessage()); } }
Example #3
Source File: DCmdDump.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public void dump(PlatformRecorder recorder, Recording recording, String name, String filename, Long maxSize, Boolean pathToGcRoots, Instant beginTime, Instant endTime) throws DCmdException { try (PlatformRecording r = newSnapShot(recorder, recording, pathToGcRoots)) { r.filter(beginTime, endTime, maxSize); if (r.getChunks().isEmpty()) { throw new DCmdException("Dump failed. No data found in the specified interval."); } SafePath dumpFile = resolvePath(recording, filename); // Needed for JVM Utils.touch(dumpFile.toPath()); r.dumpStopped(new WriteableUserPath(dumpFile.toPath())); reportOperationComplete("Dumped", name, dumpFile); } catch (IOException | InvalidPathException e) { throw new DCmdException("Dump failed. Could not copy recording data. %s", e.getMessage()); } }
Example #4
Source File: Recording.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Returns destination file, where recording data will be written when the * recording stops, or {@code null} if no destination has been set. * * @return the destination file, or {@code null} if not set. */ public Path getDestination() { WriteableUserPath usp = internal.getDestination(); if (usp == null) { return null; } else { return usp.getPotentiallyMaliciousOriginal(); } }
Example #5
Source File: Recording.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Returns the destination file, where recording data is written when the * recording stops, or {@code null} if no destination is set. * * @return the destination file, or {@code null} if not set. */ public Path getDestination() { WriteableUserPath usp = internal.getDestination(); if (usp == null) { return null; } else { return usp.getPotentiallyMaliciousOriginal(); } }
Example #6
Source File: Recording.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Returns the destination file, where recording data is written when the * recording stops, or {@code null} if no destination is set. * * @return the destination file, or {@code null} if not set. */ public Path getDestination() { WriteableUserPath usp = internal.getDestination(); if (usp == null) { return null; } else { return usp.getPotentiallyMaliciousOriginal(); } }
Example #7
Source File: Recording.java From dragonwell8_jdk with GNU General Public License v2.0 | 2 votes |
/** * Writes recording data to a file. * <p> * Recording must be started, but not necessarily stopped. * * @param destination where recording data should be written, not * {@code null} * * @throws IOException if recording can't be copied to {@code path} * * @throws SecurityException if a security manager exists and the caller * doesn't have {@code FilePermission} to write at the destination * path */ public void dump(Path destination) throws IOException { Objects.requireNonNull(destination); internal.copyTo(new WriteableUserPath(destination), "Dumped by user", Collections.emptyMap()); }
Example #8
Source File: Recording.java From dragonwell8_jdk with GNU General Public License v2.0 | 2 votes |
/** * Sets a location where data will be written on recording stop, or * {@code null} if data should not be dumped automatically. * <p> * If a destination is set, this recording will be closed automatically * after data has been copied successfully to the destination path. * <p> * If a destination is <em>not</em> set, Flight Recorder will hold on to * recording data until this recording is closed. Use {@link #dump(Path)} to * write data to a file manually. * * @param destination destination path, or {@code null} if recording should * not be dumped at stop * * @throws IllegalStateException if recording is in {@code ETOPPED} or * {@code CLOSED} state. * * @throws SecurityException if a security manager exists and the caller * doesn't have {@code FilePermission} to read, write and delete the * {@code destination} file * * @throws IOException if path is not writable */ public void setDestination(Path destination) throws IOException { internal.setDestination(destination != null ? new WriteableUserPath(destination) : null); }
Example #9
Source File: Recording.java From TencentKona-8 with GNU General Public License v2.0 | 2 votes |
/** * Writes recording data to a file. * <p> * Recording must be started, but not necessarily stopped. * * @param destination the location where recording data is written, not * {@code null} * * @throws IOException if the recording can't be copied to the specified * location * * @throws SecurityException if a security manager exists and the caller doesn't * have {@code FilePermission} to write to the destination path */ public void dump(Path destination) throws IOException { Objects.requireNonNull(destination); internal.dump(new WriteableUserPath(destination)); }
Example #10
Source File: Recording.java From TencentKona-8 with GNU General Public License v2.0 | 2 votes |
/** * Sets a location where data is written on recording stop, or * {@code null} if data is not to be dumped. * <p> * If a destination is set, this recording is automatically closed * after data is successfully copied to the destination path. * <p> * If a destination is <em>not</em> set, Flight Recorder retains the * recording data until this recording is closed. Use the {@link #dump(Path)} method to * manually write data to a file. * * @param destination the destination path, or {@code null} if recording should * not be dumped at stop * * @throws IllegalStateException if recording is in the {@code STOPPED} or * {@code CLOSED} state. * * @throws SecurityException if a security manager exists and the caller * doesn't have {@code FilePermission} to read, write, and delete the * {@code destination} file * * @throws IOException if the path is not writable */ public void setDestination(Path destination) throws IOException { internal.setDestination(destination != null ? new WriteableUserPath(destination) : null); }
Example #11
Source File: Recording.java From openjdk-jdk8u with GNU General Public License v2.0 | 2 votes |
/** * Writes recording data to a file. * <p> * Recording must be started, but not necessarily stopped. * * @param destination the location where recording data is written, not * {@code null} * * @throws IOException if the recording can't be copied to the specified * location * * @throws SecurityException if a security manager exists and the caller doesn't * have {@code FilePermission} to write to the destination path */ public void dump(Path destination) throws IOException { Objects.requireNonNull(destination); internal.dump(new WriteableUserPath(destination)); }
Example #12
Source File: Recording.java From openjdk-jdk8u with GNU General Public License v2.0 | 2 votes |
/** * Sets a location where data is written on recording stop, or * {@code null} if data is not to be dumped. * <p> * If a destination is set, this recording is automatically closed * after data is successfully copied to the destination path. * <p> * If a destination is <em>not</em> set, Flight Recorder retains the * recording data until this recording is closed. Use the {@link #dump(Path)} method to * manually write data to a file. * * @param destination the destination path, or {@code null} if recording should * not be dumped at stop * * @throws IllegalStateException if recording is in the {@code STOPPED} or * {@code CLOSED} state. * * @throws SecurityException if a security manager exists and the caller * doesn't have {@code FilePermission} to read, write, and delete the * {@code destination} file * * @throws IOException if the path is not writable */ public void setDestination(Path destination) throws IOException { internal.setDestination(destination != null ? new WriteableUserPath(destination) : null); }