Examples of interestOps()


Examples of java.nio.channels.SelectionKey.interestOps()

    }

    @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();
View Full Code Here

Examples of java.nio.channels.SelectionKey.interestOps()

    @Override
    protected boolean isInterestedInWrite(NioSession session) {
        SelectionKey key = session.getSelectionKey();
        return key.isValid()
                && (key.interestOps() & SelectionKey.OP_WRITE) != 0;
    }

    /**
     * {@inheritDoc}
     */
 
View Full Code Here

Examples of java.nio.channels.SelectionKey.interestOps()

     */
    @Override
    protected void setInterestedInRead(NioSession session, boolean isInterested)
            throws Exception {
        SelectionKey key = session.getSelectionKey();
        int oldInterestOps = key.interestOps();
        int newInterestOps = oldInterestOps;

        if (isInterested) {
            newInterestOps |= SelectionKey.OP_READ;
        } else {
View Full Code Here

Examples of java.nio.channels.SelectionKey.interestOps()

        } else {
            newInterestOps &= ~SelectionKey.OP_READ;
        }

        if (oldInterestOps != newInterestOps) {
            key.interestOps(newInterestOps);
        }
    }

    /**
     * {@inheritDoc}
 
View Full Code Here

Examples of java.nio.channels.SelectionKey.interestOps()

        if (key == null) {
            return;
        }
       
        int newInterestOps = key.interestOps();

        if (isInterested) {
            newInterestOps |= SelectionKey.OP_WRITE;
            //newInterestOps &= ~SelectionKey.OP_READ;
        } else {
View Full Code Here

Examples of java.nio.channels.SelectionKey.interestOps()

        } else {
            newInterestOps &= ~SelectionKey.OP_WRITE;
            //newInterestOps |= SelectionKey.OP_READ;
        }

        key.interestOps(newInterestOps);
    }

    @Override
    protected int read(NioSession session, IoBuffer buf) throws Exception {
        ByteChannel channel = session.getChannel();
View Full Code Here

Examples of java.nio.channels.SelectionKey.interestOps()

                                att.setCometNotify(false);
                            }
                            interestOps = (interestOps & (~OP_CALLBACK));//remove the callback flag
                            att.access();//to prevent timeout
                            //we are registering the key to start with, reset the fairness counter.
                            int ops = key.interestOps() | interestOps;
                            att.interestOps(ops);
                            if (att.getCometNotify()) key.interestOps(0);
                            else key.interestOps(ops);
                        } else {
                            cancel = true;
View Full Code Here

Examples of java.nio.channels.SelectionKey.interestOps()

                            interestOps = (interestOps & (~OP_CALLBACK));//remove the callback flag
                            att.access();//to prevent timeout
                            //we are registering the key to start with, reset the fairness counter.
                            int ops = key.interestOps() | interestOps;
                            att.interestOps(ops);
                            if (att.getCometNotify()) key.interestOps(0);
                            else key.interestOps(ops);
                        } else {
                            cancel = true;
                        }
                    } else {
View Full Code Here

Examples of java.nio.channels.SelectionKey.interestOps()

                            att.access();//to prevent timeout
                            //we are registering the key to start with, reset the fairness counter.
                            int ops = key.interestOps() | interestOps;
                            att.interestOps(ops);
                            if (att.getCometNotify()) key.interestOps(0);
                            else key.interestOps(ops);
                        } else {
                            cancel = true;
                        }
                    } else {
                        cancel = true;
View Full Code Here

Examples of java.nio.channels.SelectionKey.interestOps()

                        //only timeout sockets that we are waiting for a read from
                        long delta = now - ka.getLastAccess();
                        long timeout = ka.getTimeout();
                        boolean isTimedout = timeout > 0 && delta > timeout;
                        if ( close ) {
                            key.interestOps(0);
                            ka.interestOps(0); //avoid duplicate stop calls
                            processKey(key,ka);
                        } else if (isTimedout) {
                            key.interestOps(0);
                            ka.interestOps(0); //avoid duplicate timeout calls
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.