RFR: 8261441: JFR: Filename expansion [v7]

Denghui Dong ddong at openjdk.java.net
Wed Jun 23 11:03:26 UTC 2021


On Wed, 23 Jun 2021 08:48:59 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:

>> src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/AbstractDCmd.java line 298:
>> 
>>> 296:                 } else if (nc == 't') {
>>> 297:                     if (time == null) {
>>> 298:                         time = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss").format(new Date());
>> 
>> I use the current time here so that different filenames could be generated for multiple dumps of one process.
>
> There is a method, jdk.internal.Utils::formatDateTime, which is used to generate a filename if a directory is specified (instead of file). It would be good if the same format and method could be used with '%t'.  That method would avoids loading the SimpleDateFormat class and other time/formatting related classes.

Good suggestion.
Fixed.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4550


More information about the hotspot-jfr-dev mailing list