Package java.nio.channels

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


                        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

                case 0:
                    if (channel.getRawInterestOps() != interestOps) {
                        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();
                                }
                                key.interestOps(interestOps);
                                changed = true;
                            } finally {
                                worker.selectorGuard.readLock().unlock();
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

                        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.