Package java.nio.channels

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


                    flushSessions();
                    cancelKeys();

                    if (selector.keys().isEmpty()) {
                        synchronized (DatagramAcceptorDelegate.this) {
                            if (selector.keys().isEmpty()
                                    && registerQueue.isEmpty()
                                    && cancelQueue.isEmpty()) {
                                worker = null;
                                try {
                                    selector.close();
View Full Code Here


                    if (nKeys > 0) {
                        processSessions(selector.selectedKeys());
                    }

                    processTimedOutSessions(selector.keys());

                    if (selector.keys().isEmpty()) {
                        if (System.currentTimeMillis() - lastActive > workerTimeout * 1000L) {
                            synchronized (lock) {
                                if (selector.keys().isEmpty()
View Full Code Here

                        processSessions(selector.selectedKeys());
                    }

                    processTimedOutSessions(selector.keys());

                    if (selector.keys().isEmpty()) {
                        if (System.currentTimeMillis() - lastActive > workerTimeout * 1000L) {
                            synchronized (lock) {
                                if (selector.keys().isEmpty()
                                        && connectQueue.isEmpty()) {
                                    worker = null;
View Full Code Here

                    processTimedOutSessions(selector.keys());

                    if (selector.keys().isEmpty()) {
                        if (System.currentTimeMillis() - lastActive > workerTimeout * 1000L) {
                            synchronized (lock) {
                                if (selector.keys().isEmpty()
                                        && connectQueue.isEmpty()) {
                                    worker = null;
                                    try {
                                        selector.close();
                                    } catch (IOException e) {
View Full Code Here

                    }

                    flushSessions();
                    cancelKeys();

                    if (selector.keys().isEmpty()) {
                        synchronized (DatagramConnectorDelegate.this) {
                            if (selector.keys().isEmpty()
                                    && registerQueue.isEmpty()
                                    && cancelQueue.isEmpty()) {
                                worker = null;
View Full Code Here

                    flushSessions();
                    cancelKeys();

                    if (selector.keys().isEmpty()) {
                        synchronized (DatagramConnectorDelegate.this) {
                            if (selector.keys().isEmpty()
                                    && registerQueue.isEmpty()
                                    && cancelQueue.isEmpty()) {
                                worker = null;
                                try {
                                    selector.close();
View Full Code Here

                    doFlush();
                    doRemove();
                    notifyIdleness();

                    if (selector.keys().isEmpty()) {
                        synchronized (lock) {
                            if (selector.keys().isEmpty()
                                    && newSessions.isEmpty()) {
                                worker = null;
View Full Code Here

                    doRemove();
                    notifyIdleness();

                    if (selector.keys().isEmpty()) {
                        synchronized (lock) {
                            if (selector.keys().isEmpty()
                                    && newSessions.isEmpty()) {
                                worker = null;

                                try {
                                    selector.close();
View Full Code Here

        // process idle sessions
        long currentTime = System.currentTimeMillis();
        if ((currentTime - lastIdleCheckTime) >= 1000) {
            lastIdleCheckTime = currentTime;
            Selector selector = getSelector();
            Set keys = selector.keys();
            if (keys != null) {
                for (Iterator it = keys.iterator(); it.hasNext();) {
                    SelectionKey key = (SelectionKey) it.next();
                    SocketSessionImpl session = (SocketSessionImpl) key
                            .attachment();
View Full Code Here

    // Recreating the selector and registering all channles with
    // the new selector
    synchronized (this) {
      Selector tempSel = clientsSel;
      clientsSel = Selector.open();
      for (SelectionKey sk: tempSel.keys()) {
        IOService serv = (IOService)sk.attachment();
        sk.cancel();
        if (serv.isConnected()) {
          SocketChannel sc = serv.getSocketChannel();
          try {
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.