< prev index next >

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

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 47,64 **** public 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<>(); selectedKeys = new HashSet<>(); --- 47,64 ---- public abstract class SelectorImpl extends AbstractSelector { // The set of keys with data ready for an operation ! protected final Set<SelectionKey> selectedKeys; // The set of keys registered with this Selector ! protected final HashSet<SelectionKey> keys; // Public views of the key sets ! private final Set<SelectionKey> publicKeys; // Immutable ! private final Set<SelectionKey> publicSelectedKeys; // Removal allowed, but not addition protected SelectorImpl(SelectorProvider sp) { super(sp); keys = new HashSet<>(); selectedKeys = new HashSet<>();
*** 139,149 **** } protected abstract void implRegister(SelectionKeyImpl ski); void processDeregisterQueue() throws IOException { ! // Precondition: Synchronized on this, keys, and selectedKeys Set<SelectionKey> cks = cancelledKeys(); synchronized (cks) { if (!cks.isEmpty()) { Iterator<SelectionKey> i = cks.iterator(); while (i.hasNext()) { --- 139,151 ---- } protected abstract void implRegister(SelectionKeyImpl ski); void processDeregisterQueue() throws IOException { ! assert Thread.holdsLock(this); ! assert Thread.holdsLock(keys); ! assert Thread.holdsLock(selectedKeys); Set<SelectionKey> cks = cancelledKeys(); synchronized (cks) { if (!cks.isEmpty()) { Iterator<SelectionKey> i = cks.iterator(); while (i.hasNext()) {
< prev index next >