AsynchronousFileChannel.open() - is it blocking? (original) (raw)

Vitaly Davidovich vitalyd at gmail.com
Thu Mar 1 16:10:24 PST 2012


I'm not sure what distinction you're trying to draw in async/sync vs non-blocking/blocking. Can you clarify that part? In general, non-blocking is analogous to async and blocking to synchronous in terms of whether the caller is blocked or not -- you can certainly have a synchronous/blocking call that's actually implemented asynchronously internally, but from the caller's perspective it's a blocking call as control does not return until the method completes.

Are you instead asking whether any physical i/o will be triggered?

On Thu, Mar 1, 2012 at 6:52 PM, Zhong Yu <zhong.j.yu at gmail.com> wrote:

A synchronous action can be blocking or non-blocking. I'm asking the blocking aspect.

On Thu, Mar 1, 2012 at 5:02 PM, Vitaly Davidovich <vitalyd at gmail.com> wrote: > It's probably safe to assume that any method that doesn't return a Future or > accepts a CompletionHandler runs synchronously. > > > On Thu, Mar 1, 2012 at 5:52 PM, Zhong Yu <zhong.j.yu at gmail.com> 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(); >> >> Thanks, >> Zhong Yu > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20120301/96fbed36/attachment.html



More information about the nio-dev mailing list