()
| 148 | } |
| 149 | |
| 150 | public @NotNull Selector choice() { |
| 151 | Selector[] tmp = selectorList; // thread safe |
| 152 | if (tmp == null) |
| 153 | throw new IllegalStateException("closed"); |
| 154 | |
| 155 | long count = choiceCount.getAndIncrement(); |
| 156 | int index = (int)Long.remainderUnsigned(count, tmp.length); |
| 157 | return tmp[index]; |
| 158 | } |
| 159 | |
| 160 | public void close() { |
| 161 | lock(); |
no outgoing calls