Package java.nio.channels

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


            acceptAndAddAll(serverSelector, server, initCount);
        if (serverChannels1.size() != initCount) {
            throw new Exception("Accepted " + serverChannels1.size() +
                                " instead of " + initCount);
        }
        serverSelector.selectNow();

        // Set up mass set of client sockets.
        log("Requesting mass client connections");
        client.connectClients(massCount);
        Thread.sleep(500)// Wait for client connections to arrive
View Full Code Here


        closeAll(serverChannels1);

        // Now get the timing of select() call.
        log("Running the final select call");
        long startTime = System.nanoTime();
        serverSelector.selectNow();
        long duration = durationMillis(startTime);
        log("Init count = " + initCount +
            ", mass count = " + massCount +
            ", duration = " + duration + "ms");
View Full Code Here

    final Selector selector = provider.openSelector();

    final long timeStart = System.currentTimeMillis();

    final int readyCount = selector.selectNow();

    final long timeFinish = System.currentTimeMillis();

    final long timeDiff = timeFinish - timeStart;
View Full Code Here

            }
        } catch (ClosedSelectorException ignore){
            // Ignore
        }
        try {
            selector.selectNow();
        } catch (Throwable t){
            ExceptionUtils.handleThrowable(t);
            // Ignore everything else
        }
        selector.close();
View Full Code Here

  }

  final void selectNow() throws IOException {
    final Selector selector = this.selector;
    if (selector != null) {
      selector.selectNow();
    }
  }
}
View Full Code Here

        tmpKey.cancel();
        tmpKey = null;
      }
      if (writeSelector != null) {
        try {
          writeSelector.selectNow();
        } catch (IOException e) {
          log.error("Temp selector selectNow error", e);
        }
        // return selector
        SelectorFactory.returnSelector(writeSelector);
View Full Code Here

        tmpKey.cancel();
        tmpKey = null;
      }
      if (writeSelector != null) {
        // Cancel the key.
        writeSelector.selectNow();
        SelectorFactory.returnSelector(writeSelector);
      }
    }
    scheduleWritenBytes.addAndGet(0 - bytesProduced);
    return message.getMessage();
View Full Code Here

        tmpKey.cancel();
        tmpKey = null;
      }
      if (readSelector != null) {
        // Cancel the key.
        readSelector.selectNow();
        SelectorFactory.returnSelector(readSelector);
      }
    }
    return n;
  }
View Full Code Here

    final Selector selector = provider.openSelector();

    final long timeStart = System.currentTimeMillis();

    final int readyCount = selector.selectNow();

    final long timeFinish = System.currentTimeMillis();

    final long timeDiff = timeFinish - timeStart;
View Full Code Here

            if (tmpKey != null)
                tmpKey.cancel();
           
            if ( readSelector != null){
                try{
                    readSelector.selectNow();
                } catch (IOException ex){
                }
                SelectorFactory.returnSelector(readSelector);
            }
           
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.