Package java.nio.channels

Examples of java.nio.channels.Selector.wakeup()


    {
        scheduleTrafficControl( session );
        Selector selector = this.selector;
        if( selector != null )
        {
            selector.wakeup();
        }
    }
   
    private void scheduleTrafficControl( DatagramSessionImpl session )
    {
View Full Code Here


    {
        scheduleFlush( session );
        Selector selector = this.selector;
        if( selector != null )
        {
            selector.wakeup();
        }
    }

    void updateTrafficMask( SocketSessionImpl session )
    {
View Full Code Here

    {
        scheduleFlush( session );
        Selector selector = this.selector;
        if( selector != null )
        {
            selector.wakeup();
        }
    }

    public void closeSession( DatagramSessionImpl session )
    {
View Full Code Here

        /* ------------------------------------------------------------ */
        public void wakeup()
        {
            Selector selector = _selector;
            if (selector!=null)
                selector.wakeup();
        }

        /* ------------------------------------------------------------ */
        Selector getSelector()
        {
View Full Code Here

            BlockingClientRequest<String> clientRequest = new BlockingClientRequest<String>(new ProtocolNegotiatorClientRequest(dest.getRequestFormatType()),
                                                                                            timeoutMs);
            clientRequestExecutor.addClientRequest(clientRequest, timeoutMs, 0);

            selectorManager.registrationQueue.add(clientRequestExecutor);
            selector.wakeup();

            // Block while we wait for protocol negotiation to complete. May
            // throw interrupted exception
            boolean awaitResult = clientRequest.await();
View Full Code Here

                }
                bossExecutor.execute(new ThreadRenamingRunnable(
                        this, "New I/O client boss #" + id));
            } else {
                synchronized (selectorGuard) {
                    selector.wakeup();
                    try {
                        channel.socket.register(selector, SelectionKey.OP_CONNECT, channel);
                    } catch (ClosedChannelException e) {
                        throw new ChannelException(
                                "Failed to register a socket to the selector.", e);
View Full Code Here

            started = true;
            registerTaskQueue.offer(registerTask);
        }

        if (wakenUp.compareAndSet(false, true)) {
            selector.wakeup();
        }
    }

    public void run() {
        thread = Thread.currentThread();
View Full Code Here

                        worker.writeTaskQueue.offer(channel.writeTask);
                    }
                    Selector workerSelector = worker.selector;
                    if (workerSelector != null) {
                        if (worker.wakenUp.compareAndSet(false, true)) {
                            workerSelector.wakeup();
                        }
                    }
                    return;
                }
            }
View Full Code Here

                        if ((interestOps & SelectionKey.OP_WRITE) == 0) {
                            interestOps |= SelectionKey.OP_WRITE;
                            key.interestOps(interestOps);
                            if (Thread.currentThread() != worker.thread &&
                                worker.wakenUp.compareAndSet(false, true)) {
                                selector.wakeup();
                            }
                            changed = true;
                        }
                        break;
                    case 1:
View Full Code Here

                                changed = true;
                            } else {
                                worker.selectorGuard.readLock().lock();
                                try {
                                    if (worker.wakenUp.compareAndSet(false, true)) {
                                        selector.wakeup();
                                    }
                                    interestOps |= SelectionKey.OP_WRITE;
                                    key.interestOps(interestOps);
                                    changed = true;
                                } finally {
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.