Module exports for java.base: NIO stuff

Remi Forax forax at
Sun Dec 11 11:44:20 UTC 2016

----- Mail original -----
> De: "Alan Bateman" <Alan.Bateman at>
> À: "David M. Lloyd" <david.lloyd at>, "jigsaw-dev" <jigsaw-dev at>
> Envoyé: Dimanche 11 Décembre 2016 12:18:26
> Objet: Re: Module exports for java.base: NIO stuff

> On 10/12/2016 15:21, David M. Lloyd wrote:
>> Would it be possible to have all available selector provider
>> implementation classes listed in a "provides java.nio.channels.spi
>> with ..." section of java.base's module descriptor?  My use case is as
>> follows:
>> Our I/O library (XNIO) relies on the ability to detect and use
>> different available selector providers for different purposes in
>> different circumstances (often to provide alternatives in the event of
>> platform-specific behavior problems, or to prefer lighter providers
>> over heavier ones in certain situations).  Right now we directly use
>> reflection to seek out specific named classes. However, it would be
>> much better if we could instead use a service loader to discover all
>> available implementations, which would free us from having to use
>> reflection for this purpose and also avoid lots of pointless probing.
>> Today you need to have --add-exports=java.base/ which is
>> definitely not ideal.
>> Maybe there's another solution to this problem as well; suggestions
>> welcome.
> I don't think we've ever come across alternative implementations of
> SelectorProvider, are these complete implementations? Are you attempting
> to wrap the default implementation - I ask because there isn't anything
> in the service type (SelectorProvider in this example) that is useful
> for doing selection.

No, these are different implementation, they directly use classes from and bypass the selector API.

> -Alan.


More information about the jigsaw-dev mailing list