Package java.nio.channels

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


            } else if(byteRead == 0 && byteBuffer.position() != preReadInputBBPos) {
                byteRead += (byteBuffer.position() - preReadInputBBPos);
            }
        } finally {
            if(tmpKey != null) {
                tmpKey.cancel();
            }
            if(readSelector != null) {// Bug 6403933
                try {
                    readSelector.selectNow();
                } catch (IOException e) {
View Full Code Here


            } else if(byteRead == 0 && byteBuffer.position() != preBufPos) {
                byteRead += (byteBuffer.position() - preBufPos);
            }
        } finally {
            if(tmpKey != null) {
                tmpKey.cancel();
            }
            if(readSelector != null) {
                selectorPool.selectNowAndReturnSelector(readSelector);
            }
        }
View Full Code Here

                                        send( _serverInfo, clientInfo, selKey, obj );
                                        _channel.register( this._selector, SelectionKey.OP_READ );
                                    }
                                    else
                                    {
                                        selKey.cancel();
                                        _channel.configureBlocking( true );
                                        result = processBlocked( clientInfo, obj );

                                        if ( result != null && (result instanceof Throwable) )
                                        {
View Full Code Here

                                    }
                                }
                                else if ( selKey.isReadable() )
                                {
                                    result = receive( clientInfo );
                                    selKey.cancel();

                                    if ( result != null && (result instanceof Throwable) )
                                    {
                                        if ( !(result instanceof RemoteException) )
                                        {
View Full Code Here

                        }
                    }
                }
                finally
                {
                    selKey.cancel();
                    // beeing a little bit paranoid is sometimes better
                    clientInfo.releaseAttachment();
                    clientInfo.releaseWaitingBuffer();
                    if ( _serverInfo != null )
                    {
View Full Code Here

                        {
                            // get the underlying socket channel
                            cChannel = (SocketChannel) selKey.channel();
                            // cancel the channels registration with our
                            // Selector
                            selKey.cancel();

                            // little bit paranoia
                            if ( cChannel != null && cChannel.isOpen() )
                            {
                                // don't we support NIO?
View Full Code Here

                        {
                            // get the underlying socket channel
                            cChannel = (SocketChannel) selKey.channel();
                            // cancel the channels registration with our
                            // Selector
                            selKey.cancel();

                            // little bit paranoia
                            if ( cChannel != null && cChannel.isOpen() )
                            {
                                // don't we support NIO?
View Full Code Here

                SelectionKey key = (SelectionKey)it.next();
                Socket p = (Socket)key.attachment();
                if (p.CloseAndDelete())
                {
                    p.OnDelete(); // OnDelete closes Channel
                    key.cancel();
                    m_sockets.remove(p); // no longer Valid
                    bRemoved = true;
                }
            } // while - check for delete
            if (bRemoved)
View Full Code Here

                    }

                    // Now clear out any previously selected channels
                    for (SelectionKey k : selected) {
                        if (!added.contains(k.channel())) {
                            k.cancel();
                        }
                    }

                    //
                    // Wait for I/O on any channel
View Full Code Here

               synchronized(channel.blockingLock()) {
                   RubyIO originalIO = (RubyIO) TypeConverter.convertToType(
                           (IRubyObject) key.attachment(), runtime.getIO(),
                           MethodIndex.TO_IO, "to_io");
                   boolean blocking = originalIO.getBlocking();
                   key.cancel();
                   channel.configureBlocking(blocking);
               }
           }
           selector.close();
          
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.