Home
last modified time | relevance | path

Searched refs:SelectionKey (Results 1 – 25 of 38) sorted by relevance

12

/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/channels/
DSelectionKeyTest.java24 import java.nio.channels.SelectionKey;
38 SelectionKey selectionKey;
47 selectionKey = sc.register(selector, SelectionKey.OP_CONNECT); in setUp()
58 static class MockSelectionKey extends SelectionKey {
77 public SelectionKey interestOps(int operations) { in interestOps()
98 MockSelectionKey mockSelectionKey = new MockSelectionKey(SelectionKey.OP_ACCEPT); in test_attach()
116 MockSelectionKey mockSelectionKey = new MockSelectionKey(SelectionKey.OP_ACCEPT); in test_attachment()
137 assertEquals(SelectionKey.OP_CONNECT, selectionKey.interestOps()); in test_interestOps()
144 selectionKey.interestOps(SelectionKey.OP_WRITE); in test_interestOpsI()
145 assertEquals(SelectionKey.OP_WRITE, selectionKey.interestOps()); in test_interestOpsI()
[all …]
DSelectorTest.java26 import java.nio.channels.SelectionKey;
105 SelectionKey key = ssc.register(selector, SelectionKey.OP_ACCEPT); in test_keys()
107 Set<SelectionKey> keySet = selector.keys(); in test_keys()
108 Set<SelectionKey> keySet2 = selector.keys(); in test_keys()
112 SelectionKey key2 = keySet.iterator().next(); in test_keys()
118 SelectionKey key3 = sc.register(selector, SelectionKey.OP_READ); in test_keys()
152 ssc.register(selector, SelectionKey.OP_ACCEPT); in test_selectedKeys()
158 Set<SelectionKey> selectedKeys = selector.selectedKeys(); in test_selectedKeys()
159 Set<SelectionKey> selectedKeys2 = selector.selectedKeys(); in test_selectedKeys()
175 Set<SelectionKey> selectedKeys3 = selector.selectedKeys(); in test_selectedKeys()
[all …]
DUnixSelectorTest.java22 import java.nio.channels.SelectionKey;
65 SelectionKey mkey0 = server.serverChannel.register(sel0, SelectionKey.OP_ACCEPT); in testSelectorAcceptAndRead()
66 server.serverChannel.register(sel1, SelectionKey.OP_ACCEPT); in testSelectorAcceptAndRead()
79 socketChannel.register(sel2, SelectionKey.OP_WRITE); in testSelectorAcceptAndRead()
96 SelectionKey mkey3 = socketChannel2.register(sel3, SelectionKey.OP_WRITE); in testSelectUnConnectedChannel()
105 SelectionKey mkey4 = socketChannel2.register(sel4, SelectionKey.OP_CONNECT); in testSelectUnConnectedChannel()
111SelectionKey mkey5 = socketChannel2.register(sel5, SelectionKey.OP_CONNECT | SelectionKey.OP_WRITE… in testSelectUnConnectedChannel()
DSelectableChannelTest.java22 import java.nio.channels.SelectionKey;
40 msc.register(Selector.open(), SelectionKey.OP_ACCEPT); in test_register_LSelectorI()
65 public SelectionKey keyFor(Selector sel) { in keyFor()
73 public SelectionKey register(Selector sel, int ops, Object att) in register()
/libcore/ojluni/src/main/java/sun/nio/ch/
DSelectorImpl.java44 protected Set<SelectionKey> selectedKeys;
47 protected HashSet<SelectionKey> keys;
50 private Set<SelectionKey> publicKeys; // Immutable
51 private Set<SelectionKey> publicSelectedKeys; // Removal allowed, but not addition
55 keys = new HashSet<SelectionKey>(); in SelectorImpl()
56 selectedKeys = new HashSet<SelectionKey>(); in SelectorImpl()
66 public Set<SelectionKey> keys() { in keys()
72 public Set<SelectionKey> selectedKeys() { in selectedKeys()
123 protected final SelectionKey register(AbstractSelectableChannel ch, in register()
142 Set<SelectionKey> cks = cancelledKeys(); in processDeregisterQueue()
[all …]
DSelectionKeyImpl.java81 public SelectionKey interestOps(int ops) { in interestOps()
102 public SelectionKey nioInterestOps(int ops) { in nioInterestOps()
DSocketChannelImpl.java47 import java.nio.channels.SelectionKey;
975 ((intOps & SelectionKey.OP_READ) != 0) && in translateReadyOps()
977 newOps |= SelectionKey.OP_READ; in translateReadyOps()
980 ((intOps & SelectionKey.OP_CONNECT) != 0) && in translateReadyOps()
982 newOps |= SelectionKey.OP_CONNECT; in translateReadyOps()
987 ((intOps & SelectionKey.OP_WRITE) != 0) && in translateReadyOps()
989 newOps |= SelectionKey.OP_WRITE; in translateReadyOps()
1030 if ((ops & SelectionKey.OP_READ) != 0) in translateAndSetInterestOps()
1032 if ((ops & SelectionKey.OP_WRITE) != 0) in translateAndSetInterestOps()
1034 if ((ops & SelectionKey.OP_CONNECT) != 0) in translateAndSetInterestOps()
DSinkChannelImpl.java131 ((intOps & SelectionKey.OP_WRITE) != 0)) in translateReadyOps()
132 newOps |= SelectionKey.OP_WRITE; in translateReadyOps()
147 if (ops == SelectionKey.OP_WRITE) in translateAndSetInterestOps()
DSourceChannelImpl.java132 ((intOps & SelectionKey.OP_READ) != 0)) in translateReadyOps()
133 newOps |= SelectionKey.OP_READ; in translateReadyOps()
148 if (ops == SelectionKey.OP_READ) in translateAndSetInterestOps()
/libcore/ojluni/src/main/java/java/nio/channels/spi/
DAbstractSelectableChannel.java35 import java.nio.channels.SelectionKey;
68 private SelectionKey[] keys = null;
102 private void addKey(SelectionKey k) { in addKey()
111 keys = new SelectionKey[2]; in addKey()
115 SelectionKey[] ks = new SelectionKey[n]; in addKey()
125 private SelectionKey findKey(Selector sel) { in findKey()
136 void removeKey(SelectionKey k) { // package-private in removeKey()
168 public final SelectionKey keyFor(Selector sel) { in keyFor()
200 public final SelectionKey register(Selector sel, int ops, Object att) in register()
214 SelectionKey k = findKey(sel); in register()
[all …]
DAbstractSelector.java29 import java.nio.channels.SelectionKey;
88 private final Set<SelectionKey> cancelledKeys = new HashSet<SelectionKey>();
90 void cancel(SelectionKey k) { // package-private in cancel()
152 protected final Set<SelectionKey> cancelledKeys() { in cancelledKeys()
175 protected abstract SelectionKey register(AbstractSelectableChannel ch, in register()
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/channels/spi/
DAbstractSelectableChannelTest.java24 import java.nio.channels.SelectionKey;
114 SelectionKey acceptKey = sc.register(acceptSelector1, in test_register_LSelectorILObject()
115 SelectionKey.OP_READ, null); in test_register_LSelectorILObject()
121 acceptKey = sc.register(acceptSelector2, SelectionKey.OP_READ, null); in test_register_LSelectorILObject()
147 msc.register(acceptSelector, SelectionKey.OP_READ, null); in test_register_LSelectorILObject_IllegalArgument()
161 msc.register(acceptSelector, SelectionKey.OP_READ, null); in test_register_LSelectorILObject_IllegalArgument()
183 msc.register(acceptSelector, SelectionKey.OP_READ, null); in test_register_LSelectorILObject_IllegalArgument()
197 msc.register(acceptSelector, SelectionKey.OP_READ, null); in test_register_LSelectorILObject_IllegalArgument()
214 sc.register(null, SelectionKey.OP_READ, argObj); in test_register_LSelectorILObject_IllegalArgument()
223 msc.register(acceptSelector, SelectionKey.OP_ACCEPT, null); in test_register_LSelectorILObject_IllegalArgument()
[all …]
DAbstractSelectorTest.java22 import java.nio.channels.SelectionKey;
120 SelectionKey acceptKey = ssc.register(acceptSelector, in test_register_LSelectorI()
121 SelectionKey.OP_ACCEPT); in test_register_LSelectorI()
138 ssc.register(acceptSelector, SelectionKey.OP_ACCEPT); in test_register_LSelectorI_error()
148 ssc.register(acceptSelector, SelectionKey.OP_ACCEPT); in test_register_LSelectorI_error()
155 SelectionKey acceptKey = ssc.register(acceptSelector, in test_register_LSelectorI_error()
156 SelectionKey.OP_ACCEPT); in test_register_LSelectorI_error()
DMockAbstractSelector.java20 import java.nio.channels.SelectionKey;
48 protected SelectionKey register(AbstractSelectableChannel arg0, int arg1, in register()
65 public Set<SelectionKey> keys() { in keys()
69 public Set<SelectionKey> selectedKeys() { in selectedKeys()
DAbstractSelectionKeyTest.java20 import java.nio.channels.SelectionKey;
68 public SelectionKey interestOps(int arg0) { in interestOps()
/libcore/ojluni/src/main/java/java/nio/channels/
DSelector.java328 public abstract Set<SelectionKey> keys(); in keys()
344 public abstract Set<SelectionKey> selectedKeys(); in selectedKeys()
482 public int select(Consumer<SelectionKey> action, long timeout) in select()
519 public int select(Consumer<SelectionKey> action) throws IOException { in select()
552 public int selectNow(Consumer<SelectionKey> action) throws IOException { in selectNow()
559 private int doSelect(Consumer<SelectionKey> action, long timeout) in doSelect()
563 Set<SelectionKey> selectedKeys = selectedKeys(); in doSelect()
574 Set<SelectionKey> keysToConsume = Set.copyOf(selectedKeys); in doSelect()
DSelectionKey.java102 public abstract class SelectionKey { class
107 protected SelectionKey() { } in SelectionKey() method in SelectionKey
190 public abstract SelectionKey interestOps(int ops); in interestOps()
433 private static final AtomicReferenceFieldUpdater<SelectionKey,Object>
435 SelectionKey.class, Object.class, "attachment"
DSelectableChannel.java144 public abstract SelectionKey keyFor(Selector sel); in keyFor()
209 public abstract SelectionKey register(Selector sel, int ops, Object att) in register()
257 public final SelectionKey register(Selector sel, int ops) in register()
DPipe.java83 return SelectionKey.OP_READ; in validOps()
117 return SelectionKey.OP_WRITE; in validOps()
DSocketChannel.java219 return (SelectionKey.OP_READ in validOps()
220 | SelectionKey.OP_WRITE in validOps()
221 | SelectionKey.OP_CONNECT); in validOps()
/libcore/ojluni/src/test/java/nio/channels/SelectionKey/
DAtomicUpdates.java25 package test.java.nio.channels.SelectionKey;
39 import java.nio.channels.SelectionKey;
45 import static java.nio.channels.SelectionKey.OP_READ;
46 import static java.nio.channels.SelectionKey.OP_WRITE;
47 import static java.nio.channels.SelectionKey.OP_CONNECT;
48 import static java.nio.channels.SelectionKey.OP_ACCEPT;
54 private SelectionKey keyFor(SocketChannel sc) { in keyFor()
55 return new SelectionKey() { in keyFor()
84 public SelectionKey interestOps(int ops) { in keyFor()
99 private void test(SelectionKey key) { in test()
[all …]
/libcore/luni/src/test/java/libcore/java/nio/channels/
DSelectorTest.java25 import java.nio.channels.SelectionKey;
45 SelectionKey key = sc.register(selector, SelectionKey.OP_CONNECT); in testNonBlockingConnect_immediate()
47 assertEquals(SelectionKey.OP_CONNECT, key.readyOps()); in testNonBlockingConnect_immediate()
130 SelectionKey key = sc.register(selector, in test_57456()
131 SelectionKey.OP_CONNECT | SelectionKey.OP_READ | SelectionKey.OP_WRITE); in test_57456()
133 assertEquals(SelectionKey.OP_READ | SelectionKey.OP_WRITE, key.readyOps()); in test_57456()
166 sc.register(selector, SelectionKey.OP_READ | SelectionKey.OP_WRITE); in test28318596()
/libcore/ojluni/src/test/java/nio/channels/Selector/
DSelectWithConsumer.java38 import java.nio.channels.SelectionKey;
62 void testActionInvoked(SelectionKey key, int expectedOps) throws Exception { in testActionInvoked()
129 SelectionKey key = source.register(sel, SelectionKey.OP_READ); in testReadable()
135 testActionInvoked(key, SelectionKey.OP_READ); in testReadable()
150 SelectionKey key = sink.register(sel, SelectionKey.OP_WRITE); in testWritable()
153 testActionInvoked(key, SelectionKey.OP_WRITE); in testWritable()
171 SelectionKey key = sc.register(sel, (SelectionKey.OP_READ | in testReadableAndWriteable()
172 SelectionKey.OP_WRITE)); in testReadableAndWriteable()
179 testActionInvoked(key, (SelectionKey.OP_READ | SelectionKey.OP_WRITE)); in testReadableAndWriteable()
197 SelectionKey key1 = source.register(sel, SelectionKey.OP_READ); in testTwoChannels()
[all …]
DSelectAfterRead.java34 import java.nio.channels.SelectionKey;
55 sc.register(sel, SelectionKey.OP_READ); in testSelectAfterRead()
73 sc.register(sel, SelectionKey.OP_READ); in testSelectAfterRead()
/libcore/ojluni/annotations/hiddenapi/sun/nio/ch/
DSelectorImpl.java40 public java.util.Set<java.nio.channels.SelectionKey> keys() { in keys()
44 public java.util.Set<java.nio.channels.SelectionKey> selectedKeys() { in selectedKeys()
76 protected final java.nio.channels.SelectionKey register( in register()
93 protected java.util.HashSet<java.nio.channels.SelectionKey> keys;
95 private java.util.Set<java.nio.channels.SelectionKey> publicKeys;
98 private java.util.Set<java.nio.channels.SelectionKey> publicSelectedKeys;
101 protected java.util.Set<java.nio.channels.SelectionKey> selectedKeys;

12