Module exports for java.base: NIO stuff
David M. Lloyd
david.lloyd at redhat.com
Sun Dec 11 22:38:38 UTC 2016
On 12/11/2016 05:18 AM, Alan Bateman wrote:
> 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/sun.nio.ch=xxx 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?
I'm not implementing SelectorProvider, I just want access to all the
possible implementations that are available in the current JDK so we can
select among them on a case-by-case basis.
> 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.
Except for the name of the class, which is what we select by today.
--
- DML
More information about the jigsaw-dev
mailing list