1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty5.channel.nio;
17
18 import java.io.IOException;
19 import java.nio.channels.SelectionKey;
20 import java.nio.channels.Selector;
21 import java.nio.channels.spi.SelectorProvider;
22 import java.util.Set;
23
24 final class SelectedSelectionKeySetSelector extends Selector {
25 private final SelectedSelectionKeySet selectionKeys;
26 private final Selector delegate;
27
28 SelectedSelectionKeySetSelector(Selector delegate, SelectedSelectionKeySet selectionKeys) {
29 this.delegate = delegate;
30 this.selectionKeys = selectionKeys;
31 }
32
33 @Override
34 public boolean isOpen() {
35 return delegate.isOpen();
36 }
37
38 @Override
39 public SelectorProvider provider() {
40 return delegate.provider();
41 }
42
43 @Override
44 public Set<SelectionKey> keys() {
45 return delegate.keys();
46 }
47
48 @Override
49 public Set<SelectionKey> selectedKeys() {
50 return delegate.selectedKeys();
51 }
52
53 @Override
54 public int selectNow() throws IOException {
55 selectionKeys.reset();
56 return delegate.selectNow();
57 }
58
59 @Override
60 public int select(long timeout) throws IOException {
61 selectionKeys.reset();
62 return delegate.select(timeout);
63 }
64
65 @Override
66 public int select() throws IOException {
67 selectionKeys.reset();
68 return delegate.select();
69 }
70
71 @Override
72 public Selector wakeup() {
73 return delegate.wakeup();
74 }
75
76 @Override
77 public void close() throws IOException {
78 delegate.close();
79 }
80 }