@Override protected boolean isInterestedInRead(NioSession session) { SelectionKey key = session.getSelectionKey(); return (key != null) && key.isValid() && ((key.interestOps() & SelectionKey.OP_READ) != 0); }
@Override protected boolean isInterestedInWrite(NioSession session) { SelectionKey key = session.getSelectionKey(); return (key != null) && key.isValid() && ((key.interestOps() & SelectionKey.OP_WRITE) != 0); }
protected void setInterestedInWrite(NioSession session, boolean isInterested) throws Exception { SelectionKey key = session.getSelectionKey(); if (key == null) { return; } int newInterestOps = key.interestOps(); if (isInterested) { newInterestOps |= SelectionKey.OP_WRITE; } else { newInterestOps &= ~SelectionKey.OP_WRITE; } key.interestOps(newInterestOps); }
@Override protected boolean isReadable(NioSession session) { SelectionKey key = session.getSelectionKey(); return key.isValid() && key.isReadable(); }
@Override protected boolean isReadable(NioSession session) { SelectionKey key = session.getSelectionKey(); return (key != null) && key.isValid() && key.isReadable(); }
@Override protected boolean isWritable(NioSession session) { SelectionKey key = session.getSelectionKey(); return (key != null) && key.isValid() && key.isWritable(); }
@Override protected boolean isInterestedInRead(NioSession session) { SelectionKey key = session.getSelectionKey(); return (key != null) && key.isValid() && ((key.interestOps() & SelectionKey.OP_READ) != 0); }
@Override protected boolean isWritable(NioSession session) { SelectionKey key = session.getSelectionKey(); return (key != null) && key.isValid() && key.isWritable(); }
@Override protected boolean isReadable(NioSession session) { SelectionKey key = session.getSelectionKey(); return (key != null) && key.isValid() && key.isReadable(); }
@Override protected boolean isInterestedInWrite(NioSession session) { SelectionKey key = session.getSelectionKey(); return (key != null) && key.isValid() && ((key.interestOps() & SelectionKey.OP_WRITE) != 0); }
@Override protected boolean isWritable(NioSession session) { SelectionKey key = session.getSelectionKey(); return key.isValid() && key.isWritable(); }
@Override protected boolean isInterestedInRead(NioSession session) { SelectionKey key = session.getSelectionKey(); return key.isValid() && (key.interestOps() & SelectionKey.OP_READ) != 0; }
@Override protected boolean isInterestedInWrite(NioSession session) { SelectionKey key = session.getSelectionKey(); return key.isValid() && (key.interestOps() & SelectionKey.OP_WRITE) != 0; }
protected void setInterestedInWrite(NioSession session, boolean isInterested) throws Exception { SelectionKey key = session.getSelectionKey(); if (key == null) { return; } int newInterestOps = key.interestOps(); if (isInterested) { newInterestOps |= SelectionKey.OP_WRITE; } else { newInterestOps &= ~SelectionKey.OP_WRITE; } key.interestOps(newInterestOps); }
@Override protected void setInterestedInWrite(NioSession session, boolean interested) throws Exception { SelectionKey key = session.getSelectionKey(); if (key == null) { return; } if (interested) { key.interestOps(key.interestOps() | SelectionKey.OP_WRITE); } else { key.interestOps(key.interestOps() & ~SelectionKey.OP_WRITE); } }
protected void destroy(NioSession session) throws IOException { ByteChannel ch = session.getChannel(); SelectionKey key = session.getSelectionKey(); if (key != null) { key.cancel(); } ch.close(); }
protected void destroy(NioSession session) throws IOException { ByteChannel ch = session.getChannel(); SelectionKey key = session.getSelectionKey(); if (key != null) { key.cancel(); } ch.close(); }
@Override protected void destroy(NioSession session) throws Exception { ByteChannel ch = session.getChannel(); SelectionKey key = session.getSelectionKey(); if (key != null) { key.cancel(); } ch.close(); }
@Override protected void destroy(NioSession session) throws Exception { ByteChannel ch = session.getChannel(); SelectionKey key = session.getSelectionKey(); if (key != null) { key.cancel(); } if ( ch.isOpen() ) { ch.close(); } }
@Override protected void destroy(NioSession session) throws Exception { ByteChannel ch = session.getChannel(); SelectionKey key = session.getSelectionKey(); if (key != null) { key.cancel(); } if ( ch.isOpen() ) { ch.close(); } }