Examples of configureBlocking()


Examples of java.nio.channels.SocketChannel.configureBlocking()

                       
                        //
                        // Force the client socket to be blocking
                        //
                        synchronized (connected.blockingLock()) {
                            connected.configureBlocking(false);
                            connected.configureBlocking(true);
                        }
       
                        // otherwise one key has been selected (ours) so we get the channel and hand it off
                        socket.initSocket(context.getRuntime(), new ChannelDescriptor(connected, RubyIO.getNewFileno(), new ModeFlags(ModeFlags.RDWR), new FileDescriptor()));
View Full Code Here

Examples of java.nio.channels.SocketChannel.configureBlocking()

                        //
                        // Force the client socket to be blocking
                        //
                        synchronized (connected.blockingLock()) {
                            connected.configureBlocking(false);
                            connected.configureBlocking(true);
                        }
       
                        // otherwise one key has been selected (ours) so we get the channel and hand it off
                        socket.initSocket(context.getRuntime(), new ChannelDescriptor(connected, RubyIO.getNewFileno(), new ModeFlags(ModeFlags.RDWR), new FileDescriptor()));
                    } catch (InvalidValueException ex) {
View Full Code Here

Examples of java.nio.channels.SocketChannel.configureBlocking()

        dispatchTranslatedData( transactionContainer.getRollbackDataFile(), remoteTransactionContainer.getRollbackBufferId());
    }
   
    private SocketChannel openDataTransferChane() throws IOException{
        SocketChannel socketChannel = SocketChannel.open(new InetSocketAddress(_serverId.getHost(),JodbNetConstants.DEFAULT_DATA_STREAM_PORT));
        socketChannel.configureBlocking(true);
        return socketChannel;
    }
   
    private void dispatchTranslatedData(IRandomAccessDataBuffer randomAccessDataBuffer, int dataId) throws IOException{
        SocketChannel socketChannel =  openDataTransferChane();
View Full Code Here

Examples of java.nio.channels.SocketChannel.configureBlocking()

            throw new MinaRuntimeException("can't set socket timeout", e);
        }

        // non blocking
        try {
            clientSocket.configureBlocking(false);
        } catch (IOException e) {
            throw new MinaRuntimeException("can't configure socket as non-blocking", e);
        }

        // apply idle configuration
View Full Code Here

Examples of java.nio.channels.SocketChannel.configureBlocking()

   
    void doAccept(SelectionKey key) throws IOException,  OutOfMemoryError {
      Connection c = null;
      ServerSocketChannel server = (ServerSocketChannel) key.channel();
      SocketChannel channel = server.accept();
      channel.configureBlocking(false);
      channel.socket().setTcpNoDelay(tcpNoDelay);
      SelectionKey readKey = channel.register(selector, SelectionKey.OP_READ);
      c = new Connection(readKey, channel, System.currentTimeMillis());
      readKey.attach(c);
      synchronized (connectionList) {
View Full Code Here

Examples of java.nio.channels.SocketChannel.configureBlocking()

                ByteBuffer bb = ByteBuffer.allocateDirect(64 * 1024);
                System.err.println("Accepting connect on " + ssc.socket().getLocalPort());
                while (!Thread.interrupted()) {
                    SocketChannel sc = ssc.accept();
                    if (BUSY)
                        sc.configureBlocking(false);

                    String ra = sc.socket().getInetAddress().toString();
                    System.err.println("... connect to " + ra);
                    try {
                        sc.socket().setTcpNoDelay(true);
View Full Code Here

Examples of java.nio.channels.SocketChannel.configureBlocking()

      // accept up to 10 connections
      for (int i=0; i<10; i++) {
        SocketChannel channel = server.accept();
        if (channel==null) return;

        channel.configureBlocking(false);
        channel.socket().setTcpNoDelay(tcpNoDelay);
        SelectionKey readKey = channel.register(selector, SelectionKey.OP_READ);
        c = new Connection(readKey, channel, System.currentTimeMillis());
        readKey.attach(c);
        synchronized (connectionList) {
View Full Code Here

Examples of java.nio.channels.SocketChannel.configureBlocking()

            // prepare a channel to connect
            InetSocketAddress address = new InetSocketAddress(host, port);
            SocketChannel channel = SocketChannel.open();
   
            // configure the channel for no-blocking and selection
            channel.configureBlocking(false);
            SelectionKey selectionKey = channel.register(connectionManager.getNIODaemon().getSelector(), SelectionKey.OP_CONNECT);
   
            // prepare the handler for the connection
            client = CTPConnection.client(host, selectionKey, handler, connectionManager);
            selectionKey.attach(client);
View Full Code Here

Examples of java.nio.channels.SocketChannel.configureBlocking()

            ServerSocketChannel server = (ServerSocketChannel)key.channel();
            channel = server.accept();

            // configure the channel for no-blocking and selection
            if(channel == null) return;
            channel.configureBlocking(false);
            channelKey = channel.register(selector, 0);
        } catch(IOException e) {
            // the accept failed, there's nothing to clean up
            return;
        }
View Full Code Here

Examples of java.nio.channels.SocketChannel.configureBlocking()

        throws IOException
    {
        SocketChannel channel = SocketChannel.open();
        Address address = destination.isProxied() ? destination.getProxy() : destination.getAddress();
        channel.connect(address.toSocketAddress());
        channel.configureBlocking( false );
        channel.socket().setSoTimeout( _httpClient.getSoTimeout());
        _selectorManager.register( channel, destination );
    }

    public void run()
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.