/** * Removes cancelled keys from the key set and selected key set, and * unregisters the corresponding channels. Returns the number of keys * removed from the selected key set. */ private int doCancel() { int deselected = 0; Set<SelectionKey> cancelledKeys = cancelledKeys(); synchronized (cancelledKeys) { if (cancelledKeys.size() > 0) { for (SelectionKey currentKey : cancelledKeys) { mutableKeys.remove(currentKey); deregister((AbstractSelectionKey) currentKey); if (mutableSelectedKeys.remove(currentKey)) { deselected++; } } cancelledKeys.clear(); } } return deselected; }
@Override protected void implCloseSelector() throws IOException { wakeup(); synchronized (this) { synchronized (unmodifiableKeys) { synchronized (selectedKeys) { IoUtils.close(wakeupIn); IoUtils.close(wakeupOut); doCancel(); for (SelectionKey sk : mutableKeys) { deregister((AbstractSelectionKey) sk); } } } } }
/** * Removes cancelled keys from the key set and selected key set, and * unregisters the corresponding channels. Returns the number of keys * removed from the selected key set. */ private int doCancel() { int deselected = 0; Set<SelectionKey> cancelledKeys = cancelledKeys(); synchronized (cancelledKeys) { if (cancelledKeys.size() > 0) { for (SelectionKey currentKey : cancelledKeys) { mutableKeys.remove(currentKey); deregister((AbstractSelectionKey) currentKey); if (mutableSelectedKeys.remove(currentKey)) { deselected++; } } cancelledKeys.clear(); } } return deselected; }
/** * Removes cancelled keys from the key set and selected key set, and * unregisters the corresponding channels. Returns the number of keys * removed from the selected key set. */ private int doCancel() { int deselected = 0; Set<SelectionKey> cancelledKeys = cancelledKeys(); synchronized (cancelledKeys) { if (cancelledKeys.size() > 0) { for (SelectionKey currentKey : cancelledKeys) { mutableKeys.remove(currentKey); deregister((AbstractSelectionKey) currentKey); if (mutableSelectedKeys.remove(currentKey)) { deselected++; } } cancelledKeys.clear(); } } return deselected; }
/** * Removes cancelled keys from the key set and selected key set, and * unregisters the corresponding channels. Returns the number of keys * removed from the selected key set. */ private int doCancel() { int deselected = 0; Set<SelectionKey> cancelledKeys = cancelledKeys(); synchronized (cancelledKeys) { if (cancelledKeys.size() > 0) { for (SelectionKey currentKey : cancelledKeys) { mutableKeys.remove(currentKey); deregister((AbstractSelectionKey) currentKey); if (mutableSelectedKeys.remove(currentKey)) { deselected++; } } cancelledKeys.clear(); } } return deselected; }
/** * Removes cancelled keys from the key set and selected key set, and * unregisters the corresponding channels. Returns the number of keys * removed from the selected key set. */ private int doCancel() { int deselected = 0; Set<SelectionKey> cancelledKeys = cancelledKeys(); synchronized (cancelledKeys) { if (cancelledKeys.size() > 0) { for (SelectionKey currentKey : cancelledKeys) { mutableKeys.remove(currentKey); deregister((AbstractSelectionKey) currentKey); if (mutableSelectedKeys.remove(currentKey)) { deselected++; } } cancelledKeys.clear(); } } return deselected; }
/** * Removes cancelled keys from the key set and selected key set, and * unregisters the corresponding channels. Returns the number of keys * removed from the selected key set. */ private int doCancel() { int deselected = 0; Set<SelectionKey> cancelledKeys = cancelledKeys(); synchronized (cancelledKeys) { if (cancelledKeys.size() > 0) { for (SelectionKey currentKey : cancelledKeys) { mutableKeys.remove(currentKey); deregister((AbstractSelectionKey) currentKey); if (mutableSelectedKeys.remove(currentKey)) { deselected++; } } cancelledKeys.clear(); } } return deselected; }
/** * Removes cancelled keys from the key set and selected key set, and * unregisters the corresponding channels. Returns the number of keys * removed from the selected key set. */ private int doCancel() { int deselected = 0; Set<SelectionKey> cancelledKeys = cancelledKeys(); synchronized (cancelledKeys) { if (cancelledKeys.size() > 0) { for (SelectionKey currentKey : cancelledKeys) { mutableKeys.remove(currentKey); deregister((AbstractSelectionKey) currentKey); if (mutableSelectedKeys.remove(currentKey)) { deselected++; } } cancelledKeys.clear(); } } return deselected; }
@Override protected void implCloseSelector() throws IOException { wakeup(); synchronized (this) { synchronized (unmodifiableKeys) { synchronized (selectedKeys) { IoUtils.close(wakeupIn); IoUtils.close(wakeupOut); doCancel(); for (SelectionKey sk : mutableKeys) { deregister((AbstractSelectionKey) sk); } } } } }
@Override protected void implCloseSelector() throws IOException { wakeup(); synchronized (this) { synchronized (unmodifiableKeys) { synchronized (selectedKeys) { IoUtils.close(wakeupIn); IoUtils.close(wakeupOut); doCancel(); for (SelectionKey sk : mutableKeys) { deregister((AbstractSelectionKey) sk); } } } } }
@Override protected void implCloseSelector() throws IOException { wakeup(); synchronized (this) { synchronized (unmodifiableKeys) { synchronized (selectedKeys) { IoUtils.close(wakeupIn); IoUtils.close(wakeupOut); doCancel(); for (SelectionKey sk : mutableKeys) { deregister((AbstractSelectionKey) sk); } } } } }
@Override protected void implCloseSelector() throws IOException { wakeup(); synchronized (this) { synchronized (unmodifiableKeys) { synchronized (selectedKeys) { IoUtils.close(wakeupIn); IoUtils.close(wakeupOut); doCancel(); for (SelectionKey sk : mutableKeys) { deregister((AbstractSelectionKey) sk); } } } } }
@Override protected void implCloseSelector() throws IOException { wakeup(); synchronized (this) { synchronized (unmodifiableKeys) { synchronized (selectedKeys) { IoUtils.close(wakeupIn); IoUtils.close(wakeupOut); doCancel(); for (SelectionKey sk : mutableKeys) { deregister((AbstractSelectionKey) sk); } } } } }
@Override protected void implCloseSelector() throws IOException { wakeup(); synchronized (this) { synchronized (unmodifiableKeys) { synchronized (selectedKeys) { IoUtils.close(wakeupIn); IoUtils.close(wakeupOut); doCancel(); for (SelectionKey sk : mutableKeys) { deregister((AbstractSelectionKey) sk); } } } } }