开发者

Using FileChannel to fsync a directory with NIO.2

开发者 https://www.devze.com 2023-04-12 02:40 出处:网络
I just discovered that with NIO.2, at least under Linux, I can open a FileChannel on a directory, and call开发者_开发百科ing force(true) calls fsync() on the underlying file descriptor. Without gettin

I just discovered that with NIO.2, at least under Linux, I can open a FileChannel on a directory, and call开发者_开发百科ing force(true) calls fsync() on the underlying file descriptor. Without getting into whether this should be necessary, it's nice to finally have this functionality available in pure Java.

I haven't been able to find anywhere that this behaviour is documented, though. Can I count on this working on all Unix platforms, in future versions of Java, and in non-Oracle JVMs?


See the following thread: http://mail.openjdk.java.net/pipermail/nio-dev/2015-May/003140.html

It was not technically supported, but looks like support will be retained as many applications rely on it.


You can count on whatever the documentation says, and on nothing else.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号