use of org.webpieces.nio.api.jdk.Keys in project webpieces by deanhiller.
the class SelectorManager2 method selectorFired.
public void selectorFired() {
// NOTE: we have to process registrations as close to waitOnSelector as possible.
// otherwise, we could end up waiting on the selector when there are registrations to
// process!!!!
// currently, this processes the registration requests.
fireToListeners();
if (log.isTraceEnabled())
log.trace("coming into select");
final Keys keys = selector.select();
if (log.isTraceEnabled())
log.trace("coming out of select with newkeys=" + keys.getKeyCount() + " setSize=" + keys.getSelectedKeys().size() + " regCnt=" + listenerList.size() + " needCloseOrRegister=" + needCloseOrRegister + " wantShutdown=" + selector.isWantShutdown());
Set<SelectionKey> keySet = keys.getSelectedKeys();
needCloseOrRegister = false;
if (keySet.size() > 0) {
helper.processKeys(keySet);
}
}
use of org.webpieces.nio.api.jdk.Keys in project webpieces by deanhiller.
the class MockJdk method select.
@Override
public Keys select() {
Set<SelectionKey> keys = new HashSet<>();
for (MockSvrSideJdkChannel c : mockSvrChannel.getConnectedChannels()) {
SelectionKey key = c.getKey();
if (key != null)
keys.add(key);
}
SelectionKey key = mockSvrChannel.getKey();
if (key != null)
keys.add(key);
return new Keys(keys.size(), keys);
}
use of org.webpieces.nio.api.jdk.Keys in project webpieces by deanhiller.
the class JdkSelectorImpl method select.
public Keys select() {
try {
int count = selector.select();
Set<SelectionKey> selectedKeys = selector.selectedKeys();
return new Keys(count, selectedKeys);
} catch (IOException e) {
throw new NioException(e);
}
}
Aggregations