RFR: 8329138: Convert JFR FileForceEvent to static mirror event [v2]

Alan Bateman alanb at openjdk.org
Tue Apr 2 04:58:00 UTC 2024


On Mon, 1 Apr 2024 23:37:21 GMT, Tim Prinzing <tprinzing at openjdk.org> wrote:

>> Currently the JFR event FileForceEvent is generated by instrumenting the sun.nio.ch.FileChannelImpl class. This needs to be changed to use the newer mirror events with static methods.
>> 
>> Added the event at jdk.internal.event.FileForceEvent, and changed jdk.jfr.events.FileForceEvent to be a mirror event.
>> 
>> Updated FileChannelImpl to use the jdk internal event static methods, and removed the force() method from FileChannelImplInstrumentor.
>> 
>> Uses the existing tests.
>
> Tim Prinzing has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add support for AsynchronousFileChannel.force().

test/jdk/jdk/jfr/event/io/TestAsynchronousFileChannelEvents.java line 50:

> 48: 
> 49:     public static void main(String[] args) throws Throwable {
> 50:         File blah = File.createTempFile("blah", null);

Can you change this to use the tests's scratch rather that /tmp, meaning `Files.createTempFile(Path.of("."), "blah", "jfr")`. That way the recording is available in the event that the test fails.

test/jdk/jdk/jfr/event/io/TestAsynchronousFileChannelEvents.java line 64:

> 62: 
> 63:             data.flip();
> 64:             ch.write(data, 0);

This just initiates the write operation, it doesn't wait until it completes. It returns a Future so adding .get() will ensure that it waits and that there is potentially data to write back to the file system.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18542#discussion_r1547139762
PR Review Comment: https://git.openjdk.org/jdk/pull/18542#discussion_r1547138525



More information about the security-dev mailing list