AsynchronousFileChannel.open() - is it blocking?

Zhong Yu zhong.j.yu at gmail.com
Fri Mar 2 05:46:35 PST 2012


Thanks Alan.

Are you sure about size()? If a file is open, reading its size
attribute may require IO?

And what about close()? Could it also block?

Zhong Yu

On Fri, Mar 2, 2012 at 2:46 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> On 01/03/2012 22:52, Zhong Yu wrote:
>>
>> Is open() a potentially blocking action? Apparently so because some
>> sanity checking (e.g. existence of the file) requires disk spin. If
>> that's the case, it should probably be explicitly documented.
>>
>> And after open(), are following methods blocking or non-blocking?
>>
>>     size();
>>     truncate();
>>
> The asynchronous operations defined by AsynchronousFileChannel are read,
> write, and lock. The other methods, including the open method to create or
> open the file, are synchronous and potentially blocking.
>
> -Alan.
>


More information about the nio-dev mailing list