equal
deleted
inserted
replaced
130 } |
130 } |
131 if (duration != null) { |
131 if (duration != null) { |
132 options.add("duration=" + Utils.formatTimespan(duration, "")); |
132 options.add("duration=" + Utils.formatTimespan(duration, "")); |
133 } |
133 } |
134 if (destination != null) { |
134 if (destination != null) { |
135 options.add("filename=" + destination.getText()); |
135 options.add("filename=" + destination.getRealPathText()); |
136 } |
136 } |
137 String optionText = options.toString(); |
137 String optionText = options.toString(); |
138 if (optionText.length() != 0) { |
138 if (optionText.length() != 0) { |
139 optionText = "{" + optionText + "}"; |
139 optionText = "{" + optionText + "}"; |
140 } |
140 } |
163 WriteableUserPath dest = getDestination(); |
163 WriteableUserPath dest = getDestination(); |
164 |
164 |
165 if (dest != null) { |
165 if (dest != null) { |
166 try { |
166 try { |
167 dumpStopped(dest); |
167 dumpStopped(dest); |
168 Logger.log(LogTag.JFR, LogLevel.INFO, "Wrote recording \"" + getName() + "\" (" + getId() + ") to " + dest.getText()); |
168 Logger.log(LogTag.JFR, LogLevel.INFO, "Wrote recording \"" + getName() + "\" (" + getId() + ") to " + dest.getRealPathText()); |
169 notifyIfStateChanged(newState, oldState); |
169 notifyIfStateChanged(newState, oldState); |
170 close(); // remove if copied out |
170 close(); // remove if copied out |
171 } catch(IOException e) { |
171 } catch(IOException e) { |
172 // throw e; // BUG8925030 |
172 // throw e; // BUG8925030 |
173 } |
173 } |
316 |
316 |
317 // Recording is RUNNING, create a clone |
317 // Recording is RUNNING, create a clone |
318 PlatformRecording clone = recorder.newTemporaryRecording(); |
318 PlatformRecording clone = recorder.newTemporaryRecording(); |
319 clone.setShouldWriteActiveRecordingEvent(false); |
319 clone.setShouldWriteActiveRecordingEvent(false); |
320 clone.setName(getName()); |
320 clone.setName(getName()); |
321 clone.setDestination(this.destination); |
|
322 clone.setToDisk(true); |
321 clone.setToDisk(true); |
323 // We purposely don't clone settings here, since |
322 // We purposely don't clone settings here, since |
324 // a union a == a |
323 // a union a == a |
325 if (!isToDisk()) { |
324 if (!isToDisk()) { |
326 // force memory contents to disk |
325 // force memory contents to disk |
365 } |
364 } |
366 } |
365 } |
367 |
366 |
368 public void setDestination(WriteableUserPath userSuppliedPath) throws IOException { |
367 public void setDestination(WriteableUserPath userSuppliedPath) throws IOException { |
369 synchronized (recorder) { |
368 synchronized (recorder) { |
|
369 checkSetDestination(userSuppliedPath); |
|
370 this.destination = userSuppliedPath; |
|
371 } |
|
372 } |
|
373 |
|
374 public void checkSetDestination(WriteableUserPath userSuppliedPath) throws IOException { |
|
375 synchronized (recorder) { |
370 if (Utils.isState(getState(), RecordingState.STOPPED, RecordingState.CLOSED)) { |
376 if (Utils.isState(getState(), RecordingState.STOPPED, RecordingState.CLOSED)) { |
371 throw new IllegalStateException("Destination can't be set on a recording that has been stopped/closed"); |
377 throw new IllegalStateException("Destination can't be set on a recording that has been stopped/closed"); |
372 } |
378 } |
373 this.destination = userSuppliedPath; |
|
374 } |
379 } |
375 } |
380 } |
376 |
381 |
377 public WriteableUserPath getDestination() { |
382 public WriteableUserPath getDestination() { |
378 synchronized (recorder) { |
383 synchronized (recorder) { |