Examples of configureBlocking()


Examples of ch.unifr.nio.framework.mockups.BlockingSocketChannel.configureBlocking()

        TestTarget testTarget = new TestTarget(12345);
        testTarget.start();
        SocketChannel channel = testTarget.getSocketChannel();
        BlockingSocketChannel blockingChannel =
                new BlockingSocketChannel(channel);
        blockingChannel.configureBlocking(false);
        TestChannelHandler testChannelHandler = new TestChannelHandler();
        steppingDispatcher.registerChannel(blockingChannel, testChannelHandler);

        logger.finest("close input from target");
        testTarget.shutdownOutput();
View Full Code Here

Examples of com.sun.nio.sctp.SctpChannel.configureBlocking()

            throw new ChannelException("Failed to open a sctp channel.", e);
        }

        boolean success = false;
        try {
            underlayingChannel.configureBlocking(false);
            success = true;
        } catch (IOException e) {
            throw new ChannelException("Failed to enter non-blocking mode.", e);
        } finally {
            if (!success) {
View Full Code Here

Examples of com.sun.nio.sctp.SctpServerChannel.configureBlocking()

                ch = com.sun.nio.sctp.SctpServerChannel.open();

                // Configure the channel
                try {
                    ch.bind(new InetSocketAddress(0));
                    ch.configureBlocking(false);
                } catch (Throwable e) {
                    if (logger.isWarnEnabled()) {
                        logger.warn("Failed to configure a temporary socket.", e);
                    }
                    return -1;
View Full Code Here

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

    private static DatagramChannel createDatagramChannel(final SocketAddress sockAddr, final boolean blocking) {
        final DatagramChannel ch;
        try {
            ch = DatagramChannel.open();
            ch.configureBlocking(blocking);
        } catch (IOException e) {
            LOG.error("Failed to open DatagramChannel.", e);
            throw new IllegalStateException(e);
        }
        try {
View Full Code Here

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

           
            synchronized (selectable.blockingLock()) {
                boolean oldBlocking = selectable.isBlocking();

                try {
                    selectable.configureBlocking(false);
                   
                    io.addBlockingThread(this);
                    currentSelector = selectable.provider().openSelector();

                    SelectionKey key = selectable.register(currentSelector, ops);
View Full Code Here

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

                        }
                    }
                    currentSelector = null;
                    io.removeBlockingThread(this);
                    try {
                        selectable.configureBlocking(oldBlocking);
                    } catch (IOException ioe) {
                        // ignore; I don't like doing it, but it seems like we
                        // really just need to make all channels non-blocking by
                        // default and use select when implementing blocking ops,
                        // so if this remains set non-blocking, perhaps it's not
View Full Code Here

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

            SelectableChannel selectableChannel = (SelectableChannel)descriptor.getChannel();
            synchronized (selectableChannel.blockingLock()) {
                boolean oldBlocking = selectableChannel.isBlocking();
                try {
                    if (oldBlocking != block) {
                        selectableChannel.configureBlocking(block);
                    }
                    nWritten = descriptor.write(buffer);
                } finally {
                    if (oldBlocking != block) {
                        selectableChannel.configureBlocking(oldBlocking);
View Full Code Here

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

                        selectableChannel.configureBlocking(block);
                    }
                    nWritten = descriptor.write(buffer);
                } finally {
                    if (oldBlocking != block) {
                        selectableChannel.configureBlocking(oldBlocking);
                    }
                }
            }
        } else {
            nWritten = descriptor.write(buffer);
View Full Code Here

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

            SelectableChannel selectableChannel = (SelectableChannel)descriptor.getChannel();
            synchronized (selectableChannel.blockingLock()) {
                boolean oldBlocking = selectableChannel.isBlocking();
                try {
                    if (oldBlocking) {
                        selectableChannel.configureBlocking(false);
                    }
                    return descriptor.write(ByteBuffer.wrap(buf.unsafeBytes(), buf.begin(), buf.length()));
                } finally {
                    if (oldBlocking) {
                        selectableChannel.configureBlocking(oldBlocking);
View Full Code Here

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

                        selectableChannel.configureBlocking(false);
                    }
                    return descriptor.write(ByteBuffer.wrap(buf.unsafeBytes(), buf.begin(), buf.length()));
                } finally {
                    if (oldBlocking) {
                        selectableChannel.configureBlocking(oldBlocking);
                    }
                }
            }
        } else {
            return descriptor.write(ByteBuffer.wrap(buf.unsafeBytes(), buf.begin(), buf.length()));
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.