@ManagedAttribute(id="selection-key-handler") public String getSelectionKeyHandler() { return getType(transport.getSelectionKeyHandler()); }
@ManagedAttribute(id="selection-key-handler") public String getSelectionKeyHandler() { return getType(transport.getSelectionKeyHandler()); }
protected final void switchToNewSelector() throws IOException { final Selector oldSelector = selector; final Selector newSelector = Selectors.newSelector(transport.getSelectorProvider()); final Set<SelectionKey> keys = oldSelector.keys(); final SelectionKeyHandler selectionKeyHandler = transport.getSelectionKeyHandler(); for (final SelectionKey selectionKey : keys) { if (selectionKey.isValid()) { try { final NIOConnection nioConnection = selectionKeyHandler.getConnectionForKey(selectionKey); final SelectionKey newSelectionKey = selectionKey.channel().register(newSelector, selectionKey.interestOps(), selectionKey.attachment()); nioConnection.onSelectionKeyUpdated(newSelectionKey); } catch (Exception e) { LOGGER.log(Level.FINE, "Error switching channel to a new selector", e); } } } setSelector(newSelector); try { oldSelector.close(); } catch (Exception ignored) { } }
protected final void switchToNewSelector() throws IOException { final Selector oldSelector = selector; final Selector newSelector = Selectors.newSelector(transport.getSelectorProvider()); final Set<SelectionKey> keys = oldSelector.keys(); final SelectionKeyHandler selectionKeyHandler = transport.getSelectionKeyHandler(); for (final SelectionKey selectionKey : keys) { if (selectionKey.isValid()) { try { final NIOConnection nioConnection = selectionKeyHandler.getConnectionForKey(selectionKey); final SelectionKey newSelectionKey = selectionKey.channel().register(newSelector, selectionKey.interestOps(), selectionKey.attachment()); nioConnection.onSelectionKeyUpdated(newSelectionKey); } catch (Exception e) { LOGGER.log(Level.FINE, "Error switching channel to a new selector", e); } } } setSelector(newSelector); try { oldSelector.close(); } catch (Exception ignored) { } }
protected final void switchToNewSelector() throws IOException { final Selector oldSelector = selector; final Selector newSelector = Selectors.newSelector(transport.getSelectorProvider()); final Set<SelectionKey> keys = oldSelector.keys(); final SelectionKeyHandler selectionKeyHandler = transport.getSelectionKeyHandler(); for (final SelectionKey selectionKey : keys) { if (selectionKey.isValid()) { try { final NIOConnection nioConnection = selectionKeyHandler.getConnectionForKey(selectionKey); final SelectionKey newSelectionKey = selectionKey.channel().register(newSelector, selectionKey.interestOps(), selectionKey.attachment()); nioConnection.onSelectionKeyUpdated(newSelectionKey); } catch (Exception e) { LOGGER.log(Level.FINE, "Error switching channel to a new selector", e); } } } setSelector(newSelector); try { oldSelector.close(); } catch (Exception ignored) { } }
protected final void switchToNewSelector() throws IOException { final Selector oldSelector = selector; final Selector newSelector = Selectors.newSelector(transport.getSelectorProvider()); final Set<SelectionKey> keys = oldSelector.keys(); final SelectionKeyHandler selectionKeyHandler = transport.getSelectionKeyHandler(); for (final SelectionKey selectionKey : keys) { if (selectionKey.isValid()) { try { final NIOConnection nioConnection = selectionKeyHandler.getConnectionForKey(selectionKey); final SelectionKey newSelectionKey = selectionKey.channel().register(newSelector, selectionKey.interestOps(), selectionKey.attachment()); nioConnection.onSelectionKeyUpdated(newSelectionKey); } catch (Exception e) { LOGGER.log(Level.FINE, "Error switching channel to a new selector", e); } } } setSelector(newSelector); try { oldSelector.close(); } catch (Exception ignored) { } }
protected final void switchToNewSelector() throws IOException { final Selector oldSelector = selector; final Selector newSelector = Selectors.newSelector(transport.getSelectorProvider()); final Set<SelectionKey> keys = oldSelector.keys(); final SelectionKeyHandler selectionKeyHandler = transport.getSelectionKeyHandler(); for (final SelectionKey selectionKey : keys) { if (selectionKey.isValid()) { try { final NIOConnection nioConnection = selectionKeyHandler.getConnectionForKey(selectionKey); final SelectionKey newSelectionKey = selectionKey.channel().register(newSelector, selectionKey.interestOps(), selectionKey.attachment()); nioConnection.onSelectionKeyUpdated(newSelectionKey); } catch (Exception e) { LOGGER.log(Level.FINE, "Error switching channel to a new selector", e); } } } setSelector(newSelector); try { oldSelector.close(); } catch (Exception ignored) { } }
protected final void switchToNewSelector() throws IOException { final Selector oldSelector = selector; final Selector newSelector = Selectors.newSelector(transport.getSelectorProvider()); final Set<SelectionKey> keys = oldSelector.keys(); final SelectionKeyHandler selectionKeyHandler = transport.getSelectionKeyHandler(); for (final SelectionKey selectionKey : keys) { if (selectionKey.isValid()) { try { final NIOConnection nioConnection = selectionKeyHandler.getConnectionForKey(selectionKey); final SelectionKey newSelectionKey = selectionKey.channel().register(newSelector, selectionKey.interestOps(), selectionKey.attachment()); nioConnection.onSelectionKeyUpdated(newSelectionKey); } catch (Exception e) { LOGGER.log(Level.FINE, "Error switching channel to a new selector", e); } } } setSelector(newSelector); try { oldSelector.close(); } catch (Exception ignored) { } }
private boolean iterateKeyEvents() throws IOException { final SelectionKey keyLocal = key; final SelectionKeyHandler selectionKeyHandler = transport.getSelectionKeyHandler(); final IOStrategy ioStrategy = transport.getIOStrategy(); final IOEvent[] ioEvents = selectionKeyHandler.getIOEvents(keyReadyOps); final NIOConnection connection = selectionKeyHandler.getConnectionForKey(keyLocal); for (IOEvent ioEvent : ioEvents) { NIOConnection.notifyIOEventReady(connection, ioEvent); final int interest = ioEvent.getSelectionKeyInterest(); keyReadyOps &= (~interest); if (selectionKeyHandler.onProcessInterest(keyLocal, interest)) { if (!ioStrategy.executeIoEvent(connection, ioEvent)) { return false; } } } return true; }
private boolean iterateKeyEvents() throws IOException { final SelectionKey keyLocal = key; final SelectionKeyHandler selectionKeyHandler = transport.getSelectionKeyHandler(); final IOStrategy ioStrategy = transport.getIOStrategy(); final IOEvent[] ioEvents = selectionKeyHandler.getIOEvents(keyReadyOps); final NIOConnection connection = selectionKeyHandler.getConnectionForKey(keyLocal); for (IOEvent ioEvent : ioEvents) { NIOConnection.notifyIOEventReady(connection, ioEvent); final int interest = ioEvent.getSelectionKeyInterest(); keyReadyOps &= (~interest); if (selectionKeyHandler.onProcessInterest(keyLocal, interest)) { if (!ioStrategy.executeIoEvent(connection, ioEvent)) { return false; } } } return true; }
private boolean iterateKeyEvents() throws IOException { final SelectionKey keyLocal = key; final SelectionKeyHandler selectionKeyHandler = transport.getSelectionKeyHandler(); final IOStrategy ioStrategy = transport.getIOStrategy(); final IOEvent[] ioEvents = selectionKeyHandler.getIOEvents(keyReadyOps); final NIOConnection connection = selectionKeyHandler.getConnectionForKey(keyLocal); for (IOEvent ioEvent : ioEvents) { NIOConnection.notifyIOEventReady(connection, ioEvent); final int interest = ioEvent.getSelectionKeyInterest(); keyReadyOps &= (~interest); if (selectionKeyHandler.onProcessInterest(keyLocal, interest)) { if (!ioStrategy.executeIoEvent(connection, ioEvent)) { return false; } } } return true; }
private boolean iterateKeyEvents() throws IOException { final SelectionKey keyLocal = key; final SelectionKeyHandler selectionKeyHandler = transport.getSelectionKeyHandler(); final IOStrategy ioStrategy = transport.getIOStrategy(); final IOEvent[] ioEvents = selectionKeyHandler.getIOEvents(keyReadyOps); final NIOConnection connection = selectionKeyHandler.getConnectionForKey(keyLocal); for (IOEvent ioEvent : ioEvents) { NIOConnection.notifyIOEventReady(connection, ioEvent); final int interest = ioEvent.getSelectionKeyInterest(); keyReadyOps &= (~interest); if (selectionKeyHandler.onProcessInterest(keyLocal, interest)) { if (!ioStrategy.executeIoEvent(connection, ioEvent)) { return false; } } } return true; }
private boolean iterateKeyEvents() throws IOException { final SelectionKey keyLocal = key; final SelectionKeyHandler selectionKeyHandler = transport.getSelectionKeyHandler(); final IOStrategy ioStrategy = transport.getIOStrategy(); final IOEvent[] ioEvents = selectionKeyHandler.getIOEvents(keyReadyOps); final NIOConnection connection = selectionKeyHandler.getConnectionForKey(keyLocal); for (IOEvent ioEvent : ioEvents) { NIOConnection.notifyIOEventReady(connection, ioEvent); final int interest = ioEvent.getSelectionKeyInterest(); keyReadyOps &= (~interest); if (selectionKeyHandler.onProcessInterest(keyLocal, interest)) { if (!ioStrategy.executeIoEvent(connection, ioEvent)) { return false; } } } return true; }
private boolean iterateKeyEvents() throws IOException { final SelectionKey keyLocal = key; final SelectionKeyHandler selectionKeyHandler = transport.getSelectionKeyHandler(); final IOStrategy ioStrategy = transport.getIOStrategy(); final IOEvent[] ioEvents = selectionKeyHandler.getIOEvents(keyReadyOps); final NIOConnection connection = selectionKeyHandler.getConnectionForKey(keyLocal); for (IOEvent ioEvent : ioEvents) { NIOConnection.notifyIOEventReady(connection, ioEvent); final int interest = ioEvent.getSelectionKeyInterest(); keyReadyOps &= (~interest); if (selectionKeyHandler.onProcessInterest(keyLocal, interest)) { if (!ioStrategy.executeIoEvent(connection, ioEvent)) { return false; } } } return true; }
private boolean iterateKeyEvents() throws IOException { final SelectionKey keyLocal = key; final SelectionKeyHandler selectionKeyHandler = transport.getSelectionKeyHandler(); final IOStrategy ioStrategy = transport.getIOStrategy(); final IOEvent[] ioEvents = selectionKeyHandler.getIOEvents(keyReadyOps); final NIOConnection connection = selectionKeyHandler.getConnectionForKey(keyLocal); for (IOEvent ioEvent : ioEvents) { NIOConnection.notifyIOEventReady(connection, ioEvent); final int interest = ioEvent.getSelectionKeyInterest(); keyReadyOps &= (~interest); if (selectionKeyHandler.onProcessInterest(keyLocal, interest)) { if (!ioStrategy.executeIoEvent(connection, ioEvent)) { return false; } } } return true; }
private boolean iterateKeyEvents() throws IOException { final SelectionKey keyLocal = key; final SelectionKeyHandler selectionKeyHandler = transport.getSelectionKeyHandler(); final IOStrategy ioStrategy = transport.getIOStrategy(); final IOEvent[] ioEvents = selectionKeyHandler.getIOEvents(keyReadyOps); final NIOConnection connection = selectionKeyHandler.getConnectionForKey(keyLocal); for (IOEvent ioEvent : ioEvents) { NIOConnection.notifyIOEventReady(connection, ioEvent); final int interest = ioEvent.getSelectionKeyInterest(); keyReadyOps &= (~interest); if (selectionKeyHandler.onProcessInterest(keyLocal, interest)) { if (!ioStrategy.executeIoEvent(connection, ioEvent)) { return false; } } } return true; }
private boolean iterateKeyEvents() throws IOException { final SelectionKey keyLocal = key; final SelectionKeyHandler selectionKeyHandler = transport.getSelectionKeyHandler(); final IOStrategy ioStrategy = transport.getIOStrategy(); final IOEvent[] ioEvents = selectionKeyHandler.getIOEvents(keyReadyOps); final NIOConnection connection = selectionKeyHandler.getConnectionForKey(keyLocal); for (IOEvent ioEvent : ioEvents) { NIOConnection.notifyIOEventReady(connection, ioEvent); final int interest = ioEvent.getSelectionKeyInterest(); keyReadyOps &= (~interest); if (selectionKeyHandler.onProcessInterest(keyLocal, interest)) { if (!ioStrategy.executeIoEvent(connection, ioEvent)) { return false; } } } return true; }
private boolean iterateKeyEvents() throws IOException { final SelectionKey keyLocal = key; final SelectionKeyHandler selectionKeyHandler = transport.getSelectionKeyHandler(); final IOStrategy ioStrategy = transport.getIOStrategy(); final IOEvent[] ioEvents = selectionKeyHandler.getIOEvents(keyReadyOps); final NIOConnection connection = selectionKeyHandler.getConnectionForKey(keyLocal); for (IOEvent ioEvent : ioEvents) { NIOConnection.notifyIOEventReady(connection, ioEvent); final int interest = ioEvent.getSelectionKeyInterest(); keyReadyOps &= (~interest); if (selectionKeyHandler.onProcessInterest(keyLocal, interest)) { if (!ioStrategy.executeIoEvent(connection, ioEvent)) { return false; } } } return true; }
private boolean iterateKeyEvents() throws IOException { final SelectionKey keyLocal = key; final SelectionKeyHandler selectionKeyHandler = transport.getSelectionKeyHandler(); final IOStrategy ioStrategy = transport.getIOStrategy(); final IOEvent[] ioEvents = selectionKeyHandler.getIOEvents(keyReadyOps); final NIOConnection connection = selectionKeyHandler.getConnectionForKey(keyLocal); for (IOEvent ioEvent : ioEvents) { NIOConnection.notifyIOEventReady(connection, ioEvent); final int interest = ioEvent.getSelectionKeyInterest(); keyReadyOps &= (~interest); if (selectionKeyHandler.onProcessInterest(keyLocal, interest)) { if (!ioStrategy.executeIoEvent(connection, ioEvent)) { return false; } } } return true; }
private boolean iterateKeyEvents() throws IOException { final SelectionKey keyLocal = key; final SelectionKeyHandler selectionKeyHandler = transport.getSelectionKeyHandler(); final IOStrategy ioStrategy = transport.getIOStrategy(); final IOEvent[] ioEvents = selectionKeyHandler.getIOEvents(keyReadyOps); final NIOConnection connection = selectionKeyHandler.getConnectionForKey(keyLocal); for (IOEvent ioEvent : ioEvents) { NIOConnection.notifyIOEventReady(connection, ioEvent); final int interest = ioEvent.getSelectionKeyInterest(); keyReadyOps &= (~interest); if (selectionKeyHandler.onProcessInterest(keyLocal, interest)) { if (!ioStrategy.executeIoEvent(connection, ioEvent)) { return false; } } } return true; }