@Override
    public int select(long timeout) {
        if (!events.isEmpty()) {
            return events.size();
        }
        this.selectPromise = new DefaultPromise<>(executor);
        try {
            if(timeout == 0) {
                selectPromise.await();
            } else {
                selectPromise.await(timeout);
            }
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new RuntimeException("Was interrupted", e);
        }
        final int eventCount = events.size();
        logger.debug("returning from select with {} events", eventCount);
        return eventCount;
    }
Returns all keys that are in the events queue
@return
plc4j/transports/serial/src/main/java/org/apache/plc4x/java/transport/serial/SerialPollingSelector.java