Hard Links
Scott Palmer
swpalmer at gmail.com
Fri May 13 13:55:19 PDT 2011
On 2011-05-13, at 4:12 PM, Alan Bateman wrote:
> Scott Palmer wrote:
>> :
>> What about for Windows? It seems that the JRE should abstract this, if possible, so I don't need OS specific bits in my code unless absolutely necessary. It is odd to have this implementation-specific and OS-specific thing when the decision to support hard links was already made with the addition of the createLink API. I assume since the early docs referenced a linkCount() API that there was a conscious decision to remove it, I'm curious about the reasons for that. Or maybe it was just something that accidentally got lost when the API was juggled around and FileRef went away?
>>
>> Is there are reason this isn't part of the "basic" view?
>>
>>
> The link count is something that we would expect only very few applications will likely need. Off-hand I don't recall anyone asking for it. We did have it in an early prototype but it isn't really feasible everywhere, particularly with custom file systems. On Windows then it would impact performance if it were defined by BasicFileAttributes (based on various measurements that we did on the various win32 calls for accessing file attributes). So for now none of the file attribute views defined by the API define the link count. The API is extensible so that providers can define their own view of the attributes and in our provider then the only view that currently supports it in the "unix" view.
>
> -Alan.
Thanks for the explanation.
I can understand not getting that info as part of the BasicFileAttributes if it is going to affect performance, but it's too bad that it didn't stick around in some form. Perhaps one reason nobody asked for it is because they already thought they were getting it from the early presentations that included it :-)
I suppose I can file a RFE, as it seems a bit imbalanced to support hardlink creation in a cross-platform way, but only provide a way to get the link count on unix. After all, it isn't feasible to create a hardlink everywhere either… but as I mention above, the decision was made to support them in a cross-platform way by including createLink in the API. It seems the support is only missing this tiny bit to be "complete".
Is there any likelihood that Oracle will ship a view that supports this on Windows? Or is it basically a done deal?
Cheers,
Scott
More information about the nio-discuss
mailing list