SelectorInfo selInfo = null; SelectorProvider provider = channel.provider();
private static IOSelector getSelector(Channel channel) throws IOException { if (!(channel instanceof SelectableChannel)) { throw new IllegalArgumentException("channel must be a SelectableChannel"); } return getSelector(((SelectableChannel) channel).provider()); } public static final Condition newCondition(Channel channel, int ops, Object monitor) throws IOException {
private static IOSelector getSelector(Channel channel) throws IOException { if (!(channel instanceof SelectableChannel)) { throw new IllegalArgumentException("channel must be a SelectableChannel"); } return getSelector(((SelectableChannel) channel).provider()); } public static final Condition newCondition(Channel channel, int ops, Object monitor) throws IOException {
private static IOSelector getSelector(Channel channel) throws IOException { if (!(channel instanceof SelectableChannel)) { throw new IllegalArgumentException("channel must be a SelectableChannel"); } return getSelector(((SelectableChannel) channel).provider()); } public static final Condition newCondition(Channel channel, int ops, Object monitor) throws IOException {
private static IOSelector getSelector(Channel channel) throws IOException { if (!(channel instanceof SelectableChannel)) { throw new IllegalArgumentException("channel must be a SelectableChannel"); } return getSelector(((SelectableChannel) channel).provider()); } public static final Condition newCondition(Channel channel, int ops, Object monitor) throws IOException {
private synchronized Selector getSelector(SelectableChannel channel) throws IOException { return SelectorFactory.openWithRetryFrom(getRuntime(), channel.provider()); }
private synchronized Selector getSelector(SelectableChannel channel) throws IOException { return SelectorFactory.openWithRetryFrom(getRuntime(), channel.provider()); }
private Selector getSelector(ThreadContext context, SelectableChannel channel) throws IOException { Selector selector = selectors.get(channel.provider()); if (selector == null) { selector = SelectorFactory.openWithRetryFrom(context.runtime, channel.provider()); if (selectors.isEmpty()) { selectors = new HashMap<SelectorProvider, Selector>(); } selectors.put(channel.provider(), selector); if (!selector.provider().equals(SelectorProvider.provider())) { // need to create pipe between alt impl selector and native NIO selector Pipe pipe = Pipe.open(); ENXIOSelector enxioSelector = new ENXIOSelector(selector, pipe); if (enxioSelectors.isEmpty()) enxioSelectors = new ArrayList<ENXIOSelector>(); enxioSelectors.add(enxioSelector); pipe.source().configureBlocking(false); pipe.source().register(getSelector(context, pipe.source()), SelectionKey.OP_READ, enxioSelector); } else if (mainSelector == null) { mainSelector = selector; } } return selector; }
SelectorProvider provider = channel.provider();
private Selector getSelector(ThreadContext context, SelectableChannel channel) throws IOException { Selector selector = selectors.get(channel.provider()); if (selector == null) { selector = SelectorFactory.openWithRetryFrom(context.runtime, channel.provider()); if (selectors.isEmpty()) { selectors = new HashMap<SelectorProvider, Selector>(); } selectors.put(channel.provider(), selector); if (!selector.provider().equals(SelectorProvider.provider())) { // need to create pipe between alt impl selector and native NIO selector Pipe pipe = Pipe.open(); ENXIOSelector enxioSelector = new ENXIOSelector(selector, pipe); if (enxioSelectors.isEmpty()) enxioSelectors = new ArrayList<ENXIOSelector>(); enxioSelectors.add(enxioSelector); pipe.source().configureBlocking(false); pipe.source().register(getSelector(context, pipe.source()), SelectionKey.OP_READ, enxioSelector); } else if (mainSelector == null) { mainSelector = selector; } } return selector; }
private Selector getSelector(ThreadContext context, SelectableChannel channel) throws IOException { Selector selector = selectors.get(channel.provider()); if (selector == null) { selector = SelectorFactory.openWithRetryFrom(context.runtime, channel.provider()); if (selectors.isEmpty()) { selectors = new HashMap<SelectorProvider, Selector>(); } selectors.put(channel.provider(), selector); if (!selector.provider().equals(SelectorProvider.provider())) { // need to create pipe between alt impl selector and native NIO selector Pipe pipe = Pipe.open(); ENXIOSelector enxioSelector = new ENXIOSelector(selector, pipe); if (enxioSelectors.isEmpty()) enxioSelectors = new ArrayList<ENXIOSelector>(); enxioSelectors.add(enxioSelector); pipe.source().configureBlocking(false); pipe.source().register(getSelector(context, pipe.source()), SelectionKey.OP_READ, enxioSelector); } else if (mainSelector == null) { mainSelector = selector; } } return selector; }
private Selector getSelector(ThreadContext context, SelectableChannel channel) throws IOException { Selector selector = selectors.get(channel.provider()); if (selector == null) { selector = SelectorFactory.openWithRetryFrom(context.runtime, channel.provider()); if (selectors.isEmpty()) { selectors = new HashMap<SelectorProvider, Selector>(); } selectors.put(channel.provider(), selector); if (!selector.provider().equals(SelectorProvider.provider())) { // need to create pipe between alt impl selector and native NIO selector Pipe pipe = Pipe.open(); ENXIOSelector enxioSelector = new ENXIOSelector(selector, pipe); if (enxioSelectors.isEmpty()) enxioSelectors = new ArrayList<ENXIOSelector>(); enxioSelectors.add(enxioSelector); pipe.source().configureBlocking(false); pipe.source().register(getSelector(context, pipe.source()), SelectionKey.OP_READ, enxioSelector); } else if (mainSelector == null) { mainSelector = selector; } } return selector; }
SelectorInfo selInfo = null; SelectorProvider provider = channel.provider();
SelectorInfo selInfo = null; SelectorProvider provider = channel.provider();
public int ready() throws IOException { if (descriptor.getChannel() instanceof SelectableChannel) { int ready_stat = 0; java.nio.channels.Selector sel = SelectorFactory.openWithRetryFrom(null, ((SelectableChannel) descriptor.getChannel()).provider()); SelectableChannel selchan = (SelectableChannel)descriptor.getChannel(); synchronized (selchan.blockingLock()) { boolean is_block = selchan.isBlocking(); try { selchan.configureBlocking(false); selchan.register(sel, java.nio.channels.SelectionKey.OP_READ); ready_stat = sel.selectNow(); sel.close(); } catch (Throwable ex) { } finally { if (sel != null) { try { sel.close(); } catch (Exception e) { } } selchan.configureBlocking(is_block); } } return ready_stat; } else { return newInputStream().available(); } }
public int ready() throws IOException { if (descriptor.getChannel() instanceof SelectableChannel) { int ready_stat = 0; java.nio.channels.Selector sel = SelectorFactory.openWithRetryFrom(null, ((SelectableChannel) descriptor.getChannel()).provider()); SelectableChannel selchan = (SelectableChannel)descriptor.getChannel(); synchronized (selchan.blockingLock()) { boolean is_block = selchan.isBlocking(); try { selchan.configureBlocking(false); selchan.register(sel, java.nio.channels.SelectionKey.OP_READ); ready_stat = sel.selectNow(); sel.close(); } catch (Throwable ex) { } finally { if (sel != null) { try { sel.close(); } catch (Exception e) { } } selchan.configureBlocking(is_block); } } return ready_stat; } else { return newInputStream().available(); } }
public int ready() throws IOException { if (descriptor.getChannel() instanceof SelectableChannel) { int ready_stat = 0; java.nio.channels.Selector sel = SelectorFactory.openWithRetryFrom(null, ((SelectableChannel) descriptor.getChannel()).provider()); SelectableChannel selchan = (SelectableChannel)descriptor.getChannel(); synchronized (selchan.blockingLock()) { boolean is_block = selchan.isBlocking(); try { selchan.configureBlocking(false); selchan.register(sel, java.nio.channels.SelectionKey.OP_READ); ready_stat = sel.selectNow(); sel.close(); } catch (Throwable ex) { } finally { if (sel != null) { try { sel.close(); } catch (Exception e) { } } selchan.configureBlocking(is_block); } } return ready_stat; } else { return newInputStream().available(); } }
public int ready() throws IOException { if (descriptor.getChannel() instanceof SelectableChannel) { int ready_stat = 0; java.nio.channels.Selector sel = SelectorFactory.openWithRetryFrom(null, ((SelectableChannel) descriptor.getChannel()).provider()); SelectableChannel selchan = (SelectableChannel)descriptor.getChannel(); synchronized (selchan.blockingLock()) { boolean is_block = selchan.isBlocking(); try { selchan.configureBlocking(false); selchan.register(sel, java.nio.channels.SelectionKey.OP_READ); ready_stat = sel.selectNow(); sel.close(); } catch (Throwable ex) { } finally { if (sel != null) { try { sel.close(); } catch (Exception e) { } } selchan.configureBlocking(is_block); } } return ready_stat; } else { return newInputStream().available(); } }