/** * 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; }
/** * 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; }