Skip to content

Commit 861eea9

Browse files
committed
8302858: Polish FlightRecorderMXBeanImpl
Reviewed-by: egahlin
1 parent 60a3581 commit 861eea9

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/jdk.management.jfr/share/classes/jdk/management/jfr/FlightRecorderMXBeanImpl.java

+9-8
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public Void run() {
111111
private static final String OPTION_DUMP_ON_EXIT = "dumpOnExit";
112112
private static final String OPTION_DURATION = "duration";
113113
private static final String OPTION_DESTINATION = "destination";
114-
private static final List<String> OPTIONS = Arrays.asList(new String[] { OPTION_DUMP_ON_EXIT, OPTION_DURATION, OPTION_NAME, OPTION_MAX_AGE, OPTION_MAX_SIZE, OPTION_DISK, OPTION_DESTINATION, });
114+
private static final List<String> OPTIONS = Arrays.asList(OPTION_DUMP_ON_EXIT, OPTION_DURATION, OPTION_NAME, OPTION_MAX_AGE, OPTION_MAX_SIZE, OPTION_DISK, OPTION_DESTINATION);
115115
private final StreamManager streamHandler = new StreamManager();
116116
private final Map<Long, Object> changes = new ConcurrentHashMap<>();
117117
private final AtomicLong sequenceNumber = new AtomicLong();
@@ -282,6 +282,7 @@ public void setRecordingOptions(long recording, Map<String, String> options) thr
282282
for (Map.Entry<String, String> entry : ops.entrySet()) {
283283
Object key = entry.getKey();
284284
Object value = entry.getValue();
285+
// Keys and values may be sent over the network
285286
if (!(key instanceof String)) {
286287
throw new IllegalArgumentException("Option key must not be null, or other type than " + String.class);
287288
}
@@ -302,13 +303,13 @@ public void setRecordingOptions(long recording, Map<String, String> options) thr
302303
validateOption(ops, OPTION_DURATION, MBeanUtils::duration);
303304
validateOption(ops, OPTION_DESTINATION, x -> MBeanUtils.destination(r, x));
304305

305-
// All OK, now set them.atomically
306-
setOption(ops, OPTION_DUMP_ON_EXIT, "false", MBeanUtils::booleanValue, x -> r.setDumpOnExit(x));
307-
setOption(ops, OPTION_DISK, "true", MBeanUtils::booleanValue, x -> r.setToDisk(x));
308-
setOption(ops, OPTION_NAME, String.valueOf(r.getId()), Function.identity(), x -> r.setName(x));
309-
setOption(ops, OPTION_MAX_AGE, null, MBeanUtils::duration, x -> r.setMaxAge(x));
310-
setOption(ops, OPTION_MAX_SIZE, "0", MBeanUtils::size, x -> r.setMaxSize(x));
311-
setOption(ops, OPTION_DURATION, null, MBeanUtils::duration, x -> r.setDuration(x));
306+
// All OK, now set them
307+
setOption(ops, OPTION_DUMP_ON_EXIT, "false", MBeanUtils::booleanValue, r::setDumpOnExit);
308+
setOption(ops, OPTION_DISK, "true", MBeanUtils::booleanValue, r::setToDisk);
309+
setOption(ops, OPTION_NAME, String.valueOf(r.getId()), Function.identity(), r::setName);
310+
setOption(ops, OPTION_MAX_AGE, null, MBeanUtils::duration, r::setMaxAge);
311+
setOption(ops, OPTION_MAX_SIZE, "0", MBeanUtils::size, r::setMaxSize);
312+
setOption(ops, OPTION_DURATION, null, MBeanUtils::duration, r::setDuration);
312313
setOption(ops, OPTION_DESTINATION, null, x -> MBeanUtils.destination(r, x), x -> setOptionDestination(r, x));
313314
}
314315

0 commit comments

Comments
 (0)