Tom Tromey wrote:
> Casey>   - Adds a NativeFD interface to all our Channel 
> implementations that
> Casey> returns the native file descriptor integer. The plan 
> here would be that
> Casey> a Selector implementation could work generically given 
> that you register
> Casey> a Channel that implements NativeFD.
> 
> I think this is the only problematic bit.  AIUI we've been careful
> until now to keep the 'fd == int' identity hidden in the VM layer.
> That makes it all a bit more palatable to VMs on non-posixy platforms;
> IKVM comes to mind.

Yeah, in general int handles aren't great for me, but in this case I'm
not convinced that it's worthwhile to design a more abstract VM layer.
Sun already designed these APIs with a provider model (like the regular
sockets) and like the regular sockets I just replaced all of the *Impl
classes (although for nio I also had to replace some other classes,
which wasn't ideal I guess.)

One small point regarding this though, I think it's better to move
around references to NativeFD and do the getNativeFD call that returns
the int as late as possible (i.e. close to the native method
invocation). That will at least make it easier to replace NativeFD with
another class, should anyone want to do so. And it doesn't hurt perf or
make the code any less clear (arguably more clear).

Regards,
Jeroen

Reply via email to