src/java.base/share/classes/sun/nio/ch/SelectorImpl.java
author alanb
Wed, 02 Oct 2019 09:16:18 +0100
changeset 58439 b25362cec8ce
parent 50602 ed8de3d0cd28
child 58496 7f34de3cdfe9
permissions -rw-r--r--
8231603: (se) Selector implementations do not need to use cancelledKeys Reviewed-by: chegar, bpb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
58439
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
     2
 * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.nio.ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.IOException;
46094
0c23b05caf7d 8184330: Remove sun.nio.ch.Util.atBugLevel() either completely or at least get rid of volatile field bugLevel
clanger
parents: 32649
diff changeset
    29
import java.nio.channels.ClosedSelectorException;
0c23b05caf7d 8184330: Remove sun.nio.ch.Util.atBugLevel() either completely or at least get rid of volatile field bugLevel
clanger
parents: 32649
diff changeset
    30
import java.nio.channels.IllegalSelectorException;
49493
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
    31
import java.nio.channels.SelectableChannel;
46094
0c23b05caf7d 8184330: Remove sun.nio.ch.Util.atBugLevel() either completely or at least get rid of volatile field bugLevel
clanger
parents: 32649
diff changeset
    32
import java.nio.channels.SelectionKey;
0c23b05caf7d 8184330: Remove sun.nio.ch.Util.atBugLevel() either completely or at least get rid of volatile field bugLevel
clanger
parents: 32649
diff changeset
    33
import java.nio.channels.spi.AbstractSelectableChannel;
0c23b05caf7d 8184330: Remove sun.nio.ch.Util.atBugLevel() either completely or at least get rid of volatile field bugLevel
clanger
parents: 32649
diff changeset
    34
import java.nio.channels.spi.AbstractSelector;
0c23b05caf7d 8184330: Remove sun.nio.ch.Util.atBugLevel() either completely or at least get rid of volatile field bugLevel
clanger
parents: 32649
diff changeset
    35
import java.nio.channels.spi.SelectorProvider;
58439
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
    36
import java.util.ArrayDeque;
46094
0c23b05caf7d 8184330: Remove sun.nio.ch.Util.atBugLevel() either completely or at least get rid of volatile field bugLevel
clanger
parents: 32649
diff changeset
    37
import java.util.Collections;
58439
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
    38
import java.util.Deque;
46094
0c23b05caf7d 8184330: Remove sun.nio.ch.Util.atBugLevel() either completely or at least get rid of volatile field bugLevel
clanger
parents: 32649
diff changeset
    39
import java.util.HashSet;
0c23b05caf7d 8184330: Remove sun.nio.ch.Util.atBugLevel() either completely or at least get rid of volatile field bugLevel
clanger
parents: 32649
diff changeset
    40
import java.util.Iterator;
50602
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
    41
import java.util.Objects;
46094
0c23b05caf7d 8184330: Remove sun.nio.ch.Util.atBugLevel() either completely or at least get rid of volatile field bugLevel
clanger
parents: 32649
diff changeset
    42
import java.util.Set;
49802
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
    43
import java.util.concurrent.ConcurrentHashMap;
50602
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
    44
import java.util.function.Consumer;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * Base Selector implementation class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
58439
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
    51
public abstract class SelectorImpl
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    extends AbstractSelector
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
{
49248
15a0e60c8b97 8199611: (se) Minor selector implementation clean-up
alanb
parents: 47216
diff changeset
    54
    // The set of keys registered with this Selector
49802
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
    55
    private final Set<SelectionKey> keys;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    // The set of keys with data ready for an operation
50602
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
    58
    private final Set<SelectionKey> selectedKeys;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    // Public views of the key sets
49248
15a0e60c8b97 8199611: (se) Minor selector implementation clean-up
alanb
parents: 47216
diff changeset
    61
    private final Set<SelectionKey> publicKeys;             // Immutable
15a0e60c8b97 8199611: (se) Minor selector implementation clean-up
alanb
parents: 47216
diff changeset
    62
    private final Set<SelectionKey> publicSelectedKeys;     // Removal allowed, but not addition
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
58439
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
    64
    // pending cancelled keys for deregistration
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
    65
    private final Deque<SelectionKeyImpl> cancelledKeys = new ArrayDeque<>();
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
    66
50602
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
    67
    // used to check for reentrancy
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
    68
    private boolean inSelect;
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
    69
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    protected SelectorImpl(SelectorProvider sp) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        super(sp);
49802
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
    72
        keys = ConcurrentHashMap.newKeySet();
29986
97167d851fc4 8078467: Update core libraries to use diamond with anonymous classes
darcy
parents: 25859
diff changeset
    73
        selectedKeys = new HashSet<>();
46094
0c23b05caf7d 8184330: Remove sun.nio.ch.Util.atBugLevel() either completely or at least get rid of volatile field bugLevel
clanger
parents: 32649
diff changeset
    74
        publicKeys = Collections.unmodifiableSet(keys);
0c23b05caf7d 8184330: Remove sun.nio.ch.Util.atBugLevel() either completely or at least get rid of volatile field bugLevel
clanger
parents: 32649
diff changeset
    75
        publicSelectedKeys = Util.ungrowableSet(selectedKeys);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
49526
cad4c844902a 8200583: (se) Selector clean-up, part 4
alanb
parents: 49493
diff changeset
    78
    private void ensureOpen() {
cad4c844902a 8200583: (se) Selector clean-up, part 4
alanb
parents: 49493
diff changeset
    79
        if (!isOpen())
cad4c844902a 8200583: (se) Selector clean-up, part 4
alanb
parents: 49493
diff changeset
    80
            throw new ClosedSelectorException();
cad4c844902a 8200583: (se) Selector clean-up, part 4
alanb
parents: 49493
diff changeset
    81
    }
cad4c844902a 8200583: (se) Selector clean-up, part 4
alanb
parents: 49493
diff changeset
    82
49248
15a0e60c8b97 8199611: (se) Minor selector implementation clean-up
alanb
parents: 47216
diff changeset
    83
    @Override
15a0e60c8b97 8199611: (se) Minor selector implementation clean-up
alanb
parents: 47216
diff changeset
    84
    public final Set<SelectionKey> keys() {
49526
cad4c844902a 8200583: (se) Selector clean-up, part 4
alanb
parents: 49493
diff changeset
    85
        ensureOpen();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        return publicKeys;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
49248
15a0e60c8b97 8199611: (se) Minor selector implementation clean-up
alanb
parents: 47216
diff changeset
    89
    @Override
15a0e60c8b97 8199611: (se) Minor selector implementation clean-up
alanb
parents: 47216
diff changeset
    90
    public final Set<SelectionKey> selectedKeys() {
49526
cad4c844902a 8200583: (se) Selector clean-up, part 4
alanb
parents: 49493
diff changeset
    91
        ensureOpen();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        return publicSelectedKeys;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
49290
07779973cbe2 8199791: (se) More Selector cleanup
alanb
parents: 49248
diff changeset
    95
    /**
49493
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
    96
     * Marks the beginning of a select operation that might block
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
    97
     */
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
    98
    protected final void begin(boolean blocking) {
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
    99
        if (blocking) begin();
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   100
    }
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   101
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   102
    /**
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   103
     * Marks the end of a select operation that may have blocked
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   104
     */
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   105
    protected final void end(boolean blocking) {
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   106
        if (blocking) end();
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   107
    }
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   108
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   109
    /**
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   110
     * Selects the keys for channels that are ready for I/O operations.
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   111
     *
50602
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   112
     * @param action  the action to perform, can be null
49493
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   113
     * @param timeout timeout in milliseconds to wait, 0 to not wait, -1 to
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   114
     *                wait indefinitely
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   115
     */
50602
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   116
    protected abstract int doSelect(Consumer<SelectionKey> action, long timeout)
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   117
        throws IOException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
50602
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   119
    private int lockAndDoSelect(Consumer<SelectionKey> action, long timeout)
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   120
        throws IOException
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   121
    {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        synchronized (this) {
49526
cad4c844902a 8200583: (se) Selector clean-up, part 4
alanb
parents: 49493
diff changeset
   123
            ensureOpen();
50602
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   124
            if (inSelect)
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   125
                throw new IllegalStateException("select in progress");
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   126
            inSelect = true;
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   127
            try {
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   128
                synchronized (publicSelectedKeys) {
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   129
                    return doSelect(action, timeout);
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   130
                }
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   131
            } finally {
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   132
                inSelect = false;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
49248
15a0e60c8b97 8199611: (se) Minor selector implementation clean-up
alanb
parents: 47216
diff changeset
   137
    @Override
49802
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   138
    public final int select(long timeout) throws IOException {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        if (timeout < 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
            throw new IllegalArgumentException("Negative timeout");
50602
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   141
        return lockAndDoSelect(null, (timeout == 0) ? -1 : timeout);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
49248
15a0e60c8b97 8199611: (se) Minor selector implementation clean-up
alanb
parents: 47216
diff changeset
   144
    @Override
15a0e60c8b97 8199611: (se) Minor selector implementation clean-up
alanb
parents: 47216
diff changeset
   145
    public final int select() throws IOException {
50602
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   146
        return lockAndDoSelect(null, -1);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
49248
15a0e60c8b97 8199611: (se) Minor selector implementation clean-up
alanb
parents: 47216
diff changeset
   149
    @Override
15a0e60c8b97 8199611: (se) Minor selector implementation clean-up
alanb
parents: 47216
diff changeset
   150
    public final int selectNow() throws IOException {
50602
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   151
        return lockAndDoSelect(null, 0);
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   152
    }
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   153
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   154
    @Override
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   155
    public final int select(Consumer<SelectionKey> action, long timeout)
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   156
        throws IOException
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   157
    {
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   158
        Objects.requireNonNull(action);
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   159
        if (timeout < 0)
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   160
            throw new IllegalArgumentException("Negative timeout");
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   161
        return lockAndDoSelect(action, (timeout == 0) ? -1 : timeout);
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   162
    }
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   163
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   164
    @Override
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   165
    public final int select(Consumer<SelectionKey> action) throws IOException {
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   166
        Objects.requireNonNull(action);
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   167
        return lockAndDoSelect(action, -1);
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   168
    }
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   169
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   170
    @Override
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   171
    public final int selectNow(Consumer<SelectionKey> action) throws IOException {
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   172
        Objects.requireNonNull(action);
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   173
        return lockAndDoSelect(action, 0);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
49802
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   176
    /**
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   177
     * Invoked by implCloseSelector to close the selector.
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   178
     */
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   179
    protected abstract void implClose() throws IOException;
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   180
49248
15a0e60c8b97 8199611: (se) Minor selector implementation clean-up
alanb
parents: 47216
diff changeset
   181
    @Override
15a0e60c8b97 8199611: (se) Minor selector implementation clean-up
alanb
parents: 47216
diff changeset
   182
    public final void implCloseSelector() throws IOException {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        wakeup();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        synchronized (this) {
49493
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   185
            implClose();
49802
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   186
            synchronized (publicSelectedKeys) {
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   187
                // Deregister channels
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   188
                Iterator<SelectionKey> i = keys.iterator();
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   189
                while (i.hasNext()) {
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   190
                    SelectionKeyImpl ski = (SelectionKeyImpl)i.next();
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   191
                    deregister(ski);
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   192
                    SelectableChannel selch = ski.channel();
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   193
                    if (!selch.isOpen() && !selch.isRegistered())
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   194
                        ((SelChImpl)selch).kill();
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   195
                    selectedKeys.remove(ski);
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   196
                    i.remove();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                }
49802
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   198
                assert selectedKeys.isEmpty() && keys.isEmpty();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
49248
15a0e60c8b97 8199611: (se) Minor selector implementation clean-up
alanb
parents: 47216
diff changeset
   203
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    protected final SelectionKey register(AbstractSelectableChannel ch,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                                          int ops,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                                          Object attachment)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        if (!(ch instanceof SelChImpl))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
            throw new IllegalSelectorException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        SelectionKeyImpl k = new SelectionKeyImpl((SelChImpl)ch, this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        k.attach(attachment);
49526
cad4c844902a 8200583: (se) Selector clean-up, part 4
alanb
parents: 49493
diff changeset
   212
49802
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   213
        // register (if needed) before adding to key set
49493
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   214
        implRegister(k);
49802
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   215
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   216
        // add to the selector's key set, removing it immediately if the selector
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   217
        // is closed. The key is not in the channel's key set at this point but
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   218
        // it may be observed by a thread iterating over the selector's key set.
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   219
        keys.add(k);
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   220
        try {
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   221
            k.interestOps(ops);
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   222
        } catch (ClosedSelectorException e) {
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   223
            assert ch.keyFor(this) == null;
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   224
            keys.remove(k);
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   225
            k.cancel();
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   226
            throw e;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        return k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
49526
cad4c844902a 8200583: (se) Selector clean-up, part 4
alanb
parents: 49493
diff changeset
   231
    /**
cad4c844902a 8200583: (se) Selector clean-up, part 4
alanb
parents: 49493
diff changeset
   232
     * Register the key in the selector.
cad4c844902a 8200583: (se) Selector clean-up, part 4
alanb
parents: 49493
diff changeset
   233
     *
cad4c844902a 8200583: (se) Selector clean-up, part 4
alanb
parents: 49493
diff changeset
   234
     * The default implementation checks if the selector is open. It should
cad4c844902a 8200583: (se) Selector clean-up, part 4
alanb
parents: 49493
diff changeset
   235
     * be overridden by selector implementations as needed.
cad4c844902a 8200583: (se) Selector clean-up, part 4
alanb
parents: 49493
diff changeset
   236
     */
cad4c844902a 8200583: (se) Selector clean-up, part 4
alanb
parents: 49493
diff changeset
   237
    protected void implRegister(SelectionKeyImpl ski) {
cad4c844902a 8200583: (se) Selector clean-up, part 4
alanb
parents: 49493
diff changeset
   238
        ensureOpen();
cad4c844902a 8200583: (se) Selector clean-up, part 4
alanb
parents: 49493
diff changeset
   239
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
49802
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   241
    /**
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   242
     * Removes the key from the selector
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   243
     */
49248
15a0e60c8b97 8199611: (se) Minor selector implementation clean-up
alanb
parents: 47216
diff changeset
   244
    protected abstract void implDereg(SelectionKeyImpl ski) throws IOException;
15a0e60c8b97 8199611: (se) Minor selector implementation clean-up
alanb
parents: 47216
diff changeset
   245
49802
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   246
    /**
58439
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   247
     * Queue a cancelled key for the next selection operation
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   248
     */
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   249
    public void cancel(SelectionKeyImpl ski) {
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   250
        synchronized (cancelledKeys) {
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   251
            cancelledKeys.addLast(ski);
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   252
        }
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   253
    }
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   254
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   255
    /**
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   256
     * Invoked by selection operations to process the cancelled keys
49802
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   257
     */
49248
15a0e60c8b97 8199611: (se) Minor selector implementation clean-up
alanb
parents: 47216
diff changeset
   258
    protected final void processDeregisterQueue() throws IOException {
49493
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   259
        assert Thread.holdsLock(this);
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   260
        assert Thread.holdsLock(publicSelectedKeys);
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   261
58439
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   262
        synchronized (cancelledKeys) {
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   263
            SelectionKeyImpl ski;
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   264
            while ((ski = cancelledKeys.pollFirst()) != null) {
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   265
                // remove the key from the selector
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   266
                implDereg(ski);
49493
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   267
58439
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   268
                selectedKeys.remove(ski);
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   269
                keys.remove(ski);
49493
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   270
58439
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   271
                // remove from channel's key set
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   272
                deregister(ski);
49493
814bd31f8da0 8200257: (se) More Selector cleanup
alanb
parents: 49290
diff changeset
   273
58439
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   274
                SelectableChannel ch = ski.channel();
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   275
                if (!ch.isOpen() && !ch.isRegistered())
b25362cec8ce 8231603: (se) Selector implementations do not need to use cancelledKeys
alanb
parents: 50602
diff changeset
   276
                    ((SelChImpl)ch).kill();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    }
49290
07779973cbe2 8199791: (se) More Selector cleanup
alanb
parents: 49248
diff changeset
   280
07779973cbe2 8199791: (se) More Selector cleanup
alanb
parents: 49248
diff changeset
   281
    /**
50602
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   282
     * Invoked by selection operations to handle ready events. If an action
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   283
     * is specified then it is invoked to handle the key, otherwise the key
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   284
     * is added to the selected-key set (or updated when it is already in the
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   285
     * set).
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   286
     */
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   287
    protected final int processReadyEvents(int rOps,
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   288
                                           SelectionKeyImpl ski,
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   289
                                           Consumer<SelectionKey> action) {
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   290
        if (action != null) {
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   291
            ski.translateAndSetReadyOps(rOps);
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   292
            if ((ski.nioReadyOps() & ski.nioInterestOps()) != 0) {
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   293
                action.accept(ski);
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   294
                ensureOpen();
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   295
                return 1;
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   296
            }
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   297
        } else {
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   298
            assert Thread.holdsLock(publicSelectedKeys);
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   299
            if (selectedKeys.contains(ski)) {
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   300
                if (ski.translateAndUpdateReadyOps(rOps)) {
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   301
                    return 1;
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   302
                }
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   303
            } else {
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   304
                ski.translateAndSetReadyOps(rOps);
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   305
                if ((ski.nioReadyOps() & ski.nioInterestOps()) != 0) {
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   306
                    selectedKeys.add(ski);
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   307
                    return 1;
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   308
                }
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   309
            }
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   310
        }
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   311
        return 0;
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   312
    }
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   313
ed8de3d0cd28 8199433: (se) select(Consumer<SelectionKey> action) as alternative to selected-key set
alanb
parents: 49802
diff changeset
   314
    /**
49802
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   315
     * Invoked by interestOps to ensure the interest ops are updated at the
8ac08fa69f00 8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress
alanb
parents: 49526
diff changeset
   316
     * next selection operation.
49290
07779973cbe2 8199791: (se) More Selector cleanup
alanb
parents: 49248
diff changeset
   317
     */
49526
cad4c844902a 8200583: (se) Selector clean-up, part 4
alanb
parents: 49493
diff changeset
   318
    protected abstract void setEventOps(SelectionKeyImpl ski);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
}