private void drainSelectorQueue() { ServerConnection sc = (ServerConnection) this.selectorQueue.poll(); CancelException cce = null; while (sc != null) { try { finishCon(sc); } catch (CancelException e) { if (cce == null) { cce = e; } } sc = (ServerConnection) this.selectorQueue.poll(); } Iterator it = selectorRegistrations.iterator(); while (it.hasNext()) { try { finishCon((ServerConnection) it.next()); } catch (CancelException e) { if (cce == null) { cce = e; } } } // while if (cce != null) { throw cce; } }
private int checkRegisteredKeys(int count) { int result = count; CancelException cce = null; if (count > 0) { Iterator it = this.selectorRegistrations.iterator(); while (it.hasNext()) { ServerConnection sc = (ServerConnection) it.next(); if (isRegisteredObjectClosed(sc)) { result--; it.remove(); try { finishCon(sc); } catch (CancelException e) { if (cce == null) { cce = e; } } } } // while } if (cce != null) { throw cce; } return result; }
public void registerSC(ServerConnection sc) { synchronized (this.syncLock) { if (!isRunning()) { finishCon(sc); return; } } getSelectorQueue().offer(sc); wakeupSelector(); }
finishCon(sc); } catch (IOException ex) { finishCon(sc); logger.warn("ignoring", ex); } catch (RuntimeException ex) { finishCon(sc); logger.warn("ignoring", ex); finishCon(sc); continue; } catch (IOException ex) { finishCon(sc); if (isRunning()) { logger.warn("unexpected", ex); AcceptorImpl.this.pool.execute(sc); } catch (RejectedExecutionException rejected) { finishCon(sc); AcceptorImpl.this.stats.decThreadQueueSize(); if (!isRunning()) { finishCon(sc); if (key.isValid()) { logger.warn("ignoring event on selector key {}", key); finishCon(sc);
finishCon(sc); continue; } catch (IOException ex) { finishCon(sc); if (isRunning()) { logger.warn("Unexpected Exception:", ex); AcceptorImpl.this.pool.execute(sc); } catch (RejectedExecutionException rejected) { finishCon(sc); AcceptorImpl.this.stats.decThreadQueueSize(); if (!isRunning()) { finishCon(sc); continue; } catch (IOException ex) {