Code example for SelectionKey

Methods: attach

0
     * This method dispatches the event notification to the 
     * {@link IOEventDispatch#inputReady(IOSession)} method. 
     */ 
    @Override 
    protected void readable(final SelectionKey key) {
        final IOSession session = getSession(key);
        try { 
            this.eventDispatch.inputReady(session);
            if (session.hasBufferedInput()) {
                this.bufferingSessions.add(session);
            } 
        } catch (final CancelledKeyException ex) {
            queueClosedSession(session);
            key.attach(null);
        } catch (final RuntimeException ex) {
            handleRuntimeException(ex);
        } 
    } 
 
    /** 
     * Processes {@link SelectionKey#OP_WRITE} event on the given selection key.