Examples of keyFor()


Examples of java.nio.channels.DatagramChannel.keyFor()

            try {
                if (ch == null) {
                    request.exception = new IllegalArgumentException(
                            "Address not bound: " + request.address);
                } else {
                    SelectionKey key = ch.keyFor(selector);
                    request.registrationRequest = (RegistrationRequest) key
                            .attachment();
                    key.cancel();
                    selector.wakeup(); // wake up again to trigger thread death
                    ch.disconnect();
View Full Code Here

Examples of java.nio.channels.DatagramChannel.keyFor()

        if (selector == null || ch == null) {
            throw new IllegalArgumentException("Unknown localAddress: "
                    + localAddress);
        }

        SelectionKey key = ch.keyFor(selector);
        if (key == null) {
            throw new IllegalArgumentException("Unknown localAddress: "
                    + localAddress);
        }
View Full Code Here

Examples of java.nio.channels.DatagramChannel.keyFor()

            try {
                if (ch == null) {
                    request.exception = new IllegalArgumentException(
                            "Address not bound: " + request.address);
                } else {
                    SelectionKey key = ch.keyFor(selector);
                    request.registrationRequest = (RegistrationRequest) key
                            .attachment();
                    key.cancel();
                    selector.wakeup(); // wake up again to trigger thread death
                    ch.disconnect();
View Full Code Here

Examples of java.nio.channels.DatagramChannel.keyFor()

        if( selector == null || ch == null )
        {
            throw new IllegalArgumentException( "Unknown localAddress: " + localAddress );
        }
           
        SelectionKey key = ch.keyFor( selector );
        if( key == null )
        {
            throw new IllegalArgumentException( "Unknown localAddress: " + localAddress );
        }
View Full Code Here

Examples of java.nio.channels.SelectableChannel.keyFor()

   * @param cancellations
   */
  private void process_clear_interest_request(Interest interest) {

    SelectableChannel ch = interest.ch;
    SelectionKey key = ch.keyFor(selector);
    NIOHandler handler = interest.handler;

    if (key == null || !key.isValid()) {
     
      // TODO: maybe this should be considered an error?
View Full Code Here

Examples of java.nio.channels.SelectableChannel.keyFor()

   * @param remove
   * @param active2
   */
  private void process_add_interest_request(Interest interest) {
    SelectableChannel ch = interest.ch;
    SelectionKey key = ch.keyFor(selector);
    NIOChannelInfo info = null;
   
    if (key != null && !key.isValid()) {
      try {
        selector.selectNow();
View Full Code Here

Examples of java.nio.channels.SelectableChannel.keyFor()

                key.oldInterestOps = key.interestOps();
                boolean isReadableChannel = ((SelectionKey.OP_ACCEPT | SelectionKey.OP_READ) & key.oldInterestOps) != 0;
                boolean isWritableChannel = ((SelectionKey.OP_CONNECT | SelectionKey.OP_WRITE) & key.oldInterestOps) != 0;
                SelectableChannel channel = key.channel();                 
                if (isReadableChannel) {
                    readChannelList.add(channel.keyFor(this));
                    readableFDs.add(((FileDescriptorHandler)channel).getFD());
                }
                if (isWritableChannel) {
                    writeChannelList.add(channel.keyFor(this));
                    writableFDs.add(((FileDescriptorHandler)channel).getFD());
View Full Code Here

Examples of java.nio.channels.SelectableChannel.keyFor()

                if (isReadableChannel) {
                    readChannelList.add(channel.keyFor(this));
                    readableFDs.add(((FileDescriptorHandler)channel).getFD());
                }
                if (isWritableChannel) {
                    writeChannelList.add(channel.keyFor(this));
                    writableFDs.add(((FileDescriptorHandler)channel).getFD());
                }
            }
        }
        readableChannels = readChannelList.toArray(new SelectionKey[readChannelList.size()]);
View Full Code Here

Examples of java.nio.channels.SelectableChannel.keyFor()

            attachment.writing = false;

        SelectableChannel[] channels = handler.getChannels();
        for (int i = 0; i < channels.length; i++) {
            SelectableChannel channel = channels[i];
            SelectionKey key = channel.keyFor(selector);
            if (key != null)
                key.interestOps(key.interestOps()
                        | (channel.validOps() & interest.ops));
        }
    }
View Full Code Here

Examples of java.nio.channels.ServerSocketChannel.keyFor()

                {
                    request.exception = new IllegalArgumentException( "Address not bound: " + request.address );
                }
                else
                {
                    SelectionKey key = ssc.keyFor( selector );

                    key.cancel();

                    selector.wakeup(); // wake up again to trigger thread death
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.