A DESCRIPTION OF THE REQUEST :
sun.nio.ch.SelChImpl is presently unsupported. This interface is used to demark an AbstractSelectableChannel as being able to be registered against an sun.nio.ch.SelectorImpl.
I propose that sun.nio.ch.SelChImpl becomes supported as a part of Java NIO, perhaps as a part of java.nio.channels.spi. A better name should also be determined for SelChImpl.
JUSTIFICATION :
Supporting sun.nio.ch.SelChImpl would allow third parties to provide a SelectableChannel implementation that can leverage the existing Selector infrastructure. For example, to implement a Unix Domain Socket as per https://github.com/jnr/jnr-unixsocket, a kQueue/epoll Selector implementation has also been provided. This is duplication that could be avoided given that Java NIO already has such an implementation.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
java.nio.channels.Selector sel = java.nio.channels.Selector.open();
// Use the "sel" selector with a third party channel e.g.
jnr.unixsocket.UnixServerSocketChannel channel =
jnr.unixsocket.UnixServerSocketChannel.open();
channel.register(sel, java.nio.channels.SelectionKey.OP_ACCEPT);
ACTUAL -
java.nio.channels.IllegalSelectorException is thrown given that jnr.unixsocket.UnixServerSocketChannel does not implement sun.nio.ch.SelChImpl - which it could, but would then be unsupported.
CUSTOMER SUBMITTED WORKAROUND :
Libraries such as JNR provide their own selector implementation. This circumvents the issue but duplicates code that could be leveraged.
sun.nio.ch.SelChImpl is presently unsupported. This interface is used to demark an AbstractSelectableChannel as being able to be registered against an sun.nio.ch.SelectorImpl.
I propose that sun.nio.ch.SelChImpl becomes supported as a part of Java NIO, perhaps as a part of java.nio.channels.spi. A better name should also be determined for SelChImpl.
JUSTIFICATION :
Supporting sun.nio.ch.SelChImpl would allow third parties to provide a SelectableChannel implementation that can leverage the existing Selector infrastructure. For example, to implement a Unix Domain Socket as per https://github.com/jnr/jnr-unixsocket, a kQueue/epoll Selector implementation has also been provided. This is duplication that could be avoided given that Java NIO already has such an implementation.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
java.nio.channels.Selector sel = java.nio.channels.Selector.open();
// Use the "sel" selector with a third party channel e.g.
jnr.unixsocket.UnixServerSocketChannel channel =
jnr.unixsocket.UnixServerSocketChannel.open();
channel.register(sel, java.nio.channels.SelectionKey.OP_ACCEPT);
ACTUAL -
java.nio.channels.IllegalSelectorException is thrown given that jnr.unixsocket.UnixServerSocketChannel does not implement sun.nio.ch.SelChImpl - which it could, but would then be unsupported.
CUSTOMER SUBMITTED WORKAROUND :
Libraries such as JNR provide their own selector implementation. This circumvents the issue but duplicates code that could be leveraged.