Package ch.unifr.nio.framework.transform

Examples of ch.unifr.nio.framework.transform.ChannelWriter


                sslContext.createSSLEngine(remoteAddress, remotePort);
        sslEngine.setUseClientMode(true);

        channelReader = new ChannelReader(false, 1024, 10240);
        channelReader.setChannel(channel);
        channelWriter = new ChannelWriter(false);
        channelWriter.setChannel(channel);

        // set up output transformation chain:
        // Benchmark -> Array -> SSL
        sslOutputTransformer = new SSLOutputForwarder(
View Full Code Here


        public BenchmarkChannelHandler(int bufferSize) {
            // for plaintext connections it is better to use direct buffers
            reader = new ChannelReader(true/*direct*/,
                    bufferSize/*initial capacity*/,
                    bufferSize * 10/*max capacity*/);
            writer = new ChannelWriter(true/*direct*/);
            writer.addBufferSizeListener(this);
            // hardwire reader -> writer
            reader.setNextForwarder(writer);
            start = System.currentTimeMillis();
            System.out.println(DATE_FORMAT.format(start)
View Full Code Here

                receiveBufferSize/*initial capacity*/,
                receiveBufferSize * 10/*max capacity*/);
        reader.setNextForwarder(new BenchmarkClientTransformer());

        // setup output chain
        writer = new ChannelWriter(true/*direct*/);
        benchmarkTransformer =
                new BenchmarkForwarder(SEND_BUFFER_SIZE, true/*direct*/);
        benchmarkTransformer.setNextForwarder(writer);
        benchmarkTransformer.setChannelWriter(writer);

View Full Code Here

                new DummyTrafficClientTransformer(echoTextArea.getDocument()));

        // setup output chain without dummy traffic
        // stringToByteBuffer -> byteBufferToArray -> dummyTraffic ->
        // array sequence -> writer
        writer = new ChannelWriter(false/*direct*/);
        ByteBufferArraySequenceForwarder byteBufferArraySequenceForwarder =
                new ByteBufferArraySequenceForwarder();
        byteBufferArraySequenceForwarder.setNextForwarder(writer);
        DummyTrafficOutputForwarder dummyTrafficOutputTransformer =
                new DummyTrafficOutputForwarder(2);
View Full Code Here

        @Override
        public void forward(ByteBuffer input) throws IOException {
            switch (inputHandling) {
                case FORWARD:
                    try {
                        ChannelWriter peerWriter = peer.getChannelWriter();
                        peerWriter.forward(input);
                        forwardDone = true;
                        lock.lock();
                        try {
                            forwarded.signal();
                        } finally {
View Full Code Here

     * non-direct {@link ChannelWriter} </li> <li> stores a reference to its {@link HandlerAdapter}
     * for changing interest ops </li> </ul>
     */
    public AbstractChannelHandler() {
        channelReader = new ChannelReader(false, 1024, 10240);
        channelWriter = new ChannelWriter(false);
    }
View Full Code Here

    public AbstractChannelHandler(boolean directReading,
            int initialReadingCapacity, int maxReadingCapacity,
            boolean directWriting) {
        channelReader = new ChannelReader(directReading,
                initialReadingCapacity, maxReadingCapacity);
        channelWriter = new ChannelWriter(directWriting);
    }
View Full Code Here

        // setup all required cross references
        channelHandler.getChannelReader().setChannel(channel);
        if (channel instanceof WritableByteChannel) {
            WritableByteChannel writableByteChannel =
                    (WritableByteChannel) channel;
            ChannelWriter channelWriter = channelHandler.getChannelWriter();
            channelWriter.setChannel(writableByteChannel);
            channelWriter.setHandlerAdapter(handlerAdapter);
        }

        // !!! call this only after all required cross references are set !!!
        channelHandler.channelRegistered(handlerAdapter);
    }
View Full Code Here

        logger.finest("wait until shutdown propagated through framework");
        testChannelHandler.waitForInputClosed();

        logger.finest(
                "trigger another selection round by blocking write operation");
        ChannelWriter channelWriter = testChannelHandler.getChannelWriter();
        StringToByteBufferTransformer transformer =
                new StringToByteBufferTransformer();
        transformer.setNextForwarder(channelWriter);
        transformer.forward(
                "this must block and trigger another selection round");
View Full Code Here

        // wait for caching
        cacheStopDispatcher.waitForHandlerAdapter();

        // now test if another thread can write something to the writer
        final ChannelWriter channelWriter = testChannelHandler.getChannelWriter();
        Thread testThread = new Thread() {

            @Override
            public void run() {
                try {
View Full Code Here

TOP

Related Classes of ch.unifr.nio.framework.transform.ChannelWriter

Copyright © 2018 www.massapicom. 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.