< prev index next >

src/share/classes/sun/nio/ch/SelectorImpl.java

Print this page
rev 1409 : 6726309: Compiler warnings in nio code
Reviewed-by: sherman, iris

*** 40,78 **** abstract class SelectorImpl extends AbstractSelector { // The set of keys with data ready for an operation ! protected Set selectedKeys; // The set of keys registered with this Selector ! protected HashSet keys; // Public views of the key sets ! private Set publicKeys; // Immutable ! private Set publicSelectedKeys; // Removal allowed, but not addition protected SelectorImpl(SelectorProvider sp) { super(sp); ! keys = new HashSet(); ! selectedKeys = new HashSet(); if (Util.atBugLevel("1.4")) { publicKeys = keys; publicSelectedKeys = selectedKeys; } else { publicKeys = Collections.unmodifiableSet(keys); publicSelectedKeys = Util.ungrowableSet(selectedKeys); } } ! public Set keys() { if (!isOpen() && !Util.atBugLevel("1.4")) throw new ClosedSelectorException(); return publicKeys; } ! public Set selectedKeys() { if (!isOpen() && !Util.atBugLevel("1.4")) throw new ClosedSelectorException(); return publicSelectedKeys; } --- 40,78 ---- abstract class SelectorImpl extends AbstractSelector { // The set of keys with data ready for an operation ! protected Set<SelectionKey> selectedKeys; // The set of keys registered with this Selector ! protected HashSet<SelectionKey> keys; // Public views of the key sets ! private Set<SelectionKey> publicKeys; // Immutable ! private Set<SelectionKey> publicSelectedKeys; // Removal allowed, but not addition protected SelectorImpl(SelectorProvider sp) { super(sp); ! keys = new HashSet<SelectionKey>(); ! selectedKeys = new HashSet<SelectionKey>(); if (Util.atBugLevel("1.4")) { publicKeys = keys; publicSelectedKeys = selectedKeys; } else { publicKeys = Collections.unmodifiableSet(keys); publicSelectedKeys = Util.ungrowableSet(selectedKeys); } } ! public Set<SelectionKey> keys() { if (!isOpen() && !Util.atBugLevel("1.4")) throw new ClosedSelectorException(); return publicKeys; } ! public Set<SelectionKey> selectedKeys() { if (!isOpen() && !Util.atBugLevel("1.4")) throw new ClosedSelectorException(); return publicSelectedKeys; }
< prev index next >