SolarisWatchKey
Michael Hall
mik3hall at gmail.com
Mon Jun 25 02:41:38 PDT 2012
On Jun 25, 2012, at 4:00 AM, Alan Bateman wrote:
> On 24/06/2012 14:42, Michael Hall wrote:
>> As I think was mentioned previously I am trying to implement some WatchService code.
>> I am for now sort picking SolarisWatchService to model how I am framing my code.
>> Something was causing me a little trouble and I thought I'd verify it is intended and isn't at least a little confusing in the Solaris implementation.
>> My source might be non-current and this already changed, my apologies if that is the case.
>>
>> AbstractWatchKey has the field
>>
>> // pending events
>> private List<WatchEvent<?>> events;
>>
>> I can't test exactly this having no Solaris access but I believe this means for SolarisWatchKey which doesn't override pollEvents that this AbstractWatchKey method will return the List field.
> It might be better to rename this field to pendingEvents to make it clearer. The methods that access it (pollEvents, signalEvent and reset) are final.
I ran the abstract superclass and and subclass together in this case since I didn't have access to the abstract. I ran into problems with the field doing double duty attempting that. Otherwise it probably would not usually matter as long the abstract methods are final for access to the private field. Although different names for the fields for anyone even just trying to understand the code might be clearer.
>
> Note that the Solaris 11 WatchService implementation is significantly more complicated that the implementations for the other platforms so you might be better looking at the other implementations first to get a feel for how they work.
>
> -Alan.
It wasn't immediately clear what the Solaris implementation was doing but then none of the watch services were simple at a quick glance . This is definitely more involved than accessing api's for file attributes. I was hoping to get something in place modeling the process and then start removing it's original functionality and replace that with kqueue/fsevents. I will look at the others as you suggest if that simplifies understanding things I'm all for it.
More information about the nio-dev
mailing list