On 12/12/2016 01:11 AM, Alan Bateman wrote:
On 11/12/2016 22:38, David M. Lloyd wrote:
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.
At least in JDK 9 then the only platform in OpenJDK (or Oracle JDK
builds) where there is more than one implementation is Solaris (it has a
/dev/poll and Solaris I/O ports based implementations). Maybe XNIO wants
to use the legacy poll based Selector on Mondays? It will be out of luck
in JDK 9 as that implementation is excluded by the build (it wasn't
deleted because some people wanted to keep it around for bootstrapping
new ports).
That's unfortunate.
So I will guess that SelectorProvider::provider gets you
most of the way. Maybe this request is rooted in the proposal to add a
poll method to SocketChannel that didn't come to a timely conclusion?
Exactly, and also as a last-ditch option where we can change to
PollSelectorProvider when things aren't working right.
In any case, what you are asking for would require a spec update.
Specifically SelectorProvider::provider would need to specify that it
ignores "built-in" implementations that are located via ServiceLoader.
It would need an implementation changes too. Nothing too difficult of
course but it just not something that has ever come up before (at least
to my knowledge).
OK, I guess we'll just deal with it.
--
- DML