Correctly implement SelectedSelectionKeySet.remove(...) / contains(...) again so it works with the NIO Selector.
Motivation:c1a335446d
reimplemented remove(...) and contains(...) in a way which made it not work anymore when used by the Selector. Modifications: Partly revert changes inc1a335446d
. Result: Works again as expected
This commit is contained in:
parent
f4bafd4fe0
commit
187b1b8a55
@ -44,6 +44,16 @@ final class SelectedSelectionKeySet extends AbstractSet<SelectionKey> {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return size;
|
||||
|
@ -97,8 +97,8 @@ public class SelectedSelectionKeySetTest {
|
||||
SelectedSelectionKeySet set = new SelectedSelectionKeySet();
|
||||
assertTrue(set.add(mockKey));
|
||||
assertTrue(set.add(mockKey2));
|
||||
assertTrue(set.contains(mockKey));
|
||||
assertTrue(set.contains(mockKey2));
|
||||
assertFalse(set.contains(mockKey));
|
||||
assertFalse(set.contains(mockKey2));
|
||||
assertFalse(set.contains(mockKey3));
|
||||
}
|
||||
|
||||
@ -106,12 +106,7 @@ public class SelectedSelectionKeySetTest {
|
||||
public void remove() {
|
||||
SelectedSelectionKeySet set = new SelectedSelectionKeySet();
|
||||
assertTrue(set.add(mockKey));
|
||||
assertFalse(set.remove(mockKey));
|
||||
assertFalse(set.remove(mockKey2));
|
||||
try {
|
||||
set.remove(mockKey);
|
||||
fail();
|
||||
} catch (UnsupportedOperationException expected) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user