< prev index next >

src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java

Print this page




 129                 throw new DCmdException("Could not start recording, duration must be at least 1 second.");
 130             }
 131         }
 132 
 133         if (delay != null) {
 134             if (delay < 1000L * 1000L * 1000) {
 135                 // to avoid typo, delay shorter than 1s makes no sense.
 136                 throw new DCmdException("Could not start recording, delay must be at least 1 second.");
 137             }
 138         }
 139 
 140         if (!FlightRecorder.isInitialized() && delay == null) {
 141             initializeWithForcedInstrumentation(s);
 142         }
 143 
 144         Recording recording = new Recording();
 145         if (name != null) {
 146             recording.setName(name);
 147         }
 148 


 149         if (disk != null) {
 150             recording.setToDisk(disk.booleanValue());
 151         }
 152         recording.setSettings(s);
 153         SafePath safePath = null;
 154 
 155         if (path != null) {
 156             try {
 157                 if (dumpOnExit == null) {
 158                     // default to dumponexit=true if user specified filename
 159                     dumpOnExit = Boolean.TRUE;
 160                 }
 161                 Path p = Paths.get(path);
 162                 if (Files.isDirectory(p) && Boolean.TRUE.equals(dumpOnExit)) {
 163                     // Decide destination filename at dump time
 164                     // Purposely avoid generating filename in Recording#setDestination due to
 165                     // security concerns
 166                     PrivateAccess.getInstance().getPlatformRecording(recording).setDumpOnExitDirectory(new SafePath(p));
 167                 } else {
 168                     safePath = resolvePath(recording, path);




 129                 throw new DCmdException("Could not start recording, duration must be at least 1 second.");
 130             }
 131         }
 132 
 133         if (delay != null) {
 134             if (delay < 1000L * 1000L * 1000) {
 135                 // to avoid typo, delay shorter than 1s makes no sense.
 136                 throw new DCmdException("Could not start recording, delay must be at least 1 second.");
 137             }
 138         }
 139 
 140         if (!FlightRecorder.isInitialized() && delay == null) {
 141             initializeWithForcedInstrumentation(s);
 142         }
 143 
 144         Recording recording = new Recording();
 145         if (name != null) {
 146             recording.setName(name);
 147         }
 148 
 149         PrivateAccess.getInstance().getPlatformRecording(recording).setConfigNames(Arrays.asList(settings));
 150 
 151         if (disk != null) {
 152             recording.setToDisk(disk.booleanValue());
 153         }
 154         recording.setSettings(s);
 155         SafePath safePath = null;
 156 
 157         if (path != null) {
 158             try {
 159                 if (dumpOnExit == null) {
 160                     // default to dumponexit=true if user specified filename
 161                     dumpOnExit = Boolean.TRUE;
 162                 }
 163                 Path p = Paths.get(path);
 164                 if (Files.isDirectory(p) && Boolean.TRUE.equals(dumpOnExit)) {
 165                     // Decide destination filename at dump time
 166                     // Purposely avoid generating filename in Recording#setDestination due to
 167                     // security concerns
 168                     PrivateAccess.getInstance().getPlatformRecording(recording).setDumpOnExitDirectory(new SafePath(p));
 169                 } else {
 170                     safePath = resolvePath(recording, path);


< prev index next >