Package org.apache.mina.api

Examples of org.apache.mina.api.IoHandler


            for (int i = size - 1; i >= 0; i--) {
                chain[i].messageSent(this, highLevelMessage);
            }

            IoHandler handler = getService().getIoHandler();

            if (handler != null) {
                IoHandlerExecutor executor = getService().getIoHandlerExecutor();

                if (executor != null) {
                    // asynchronous event
                    executor.execute(new SentEvent(this, highLevelMessage));
                } else {
                    // synchronous call (in the I/O loop)
                    handler.messageSent(this, highLevelMessage);
                }
            }
        } catch (RuntimeException e) {
            processException(e);
        }
View Full Code Here


    public void callReadNextFilter(Object message) {
        readChainPosition++;

        if (readChainPosition >= chain.length) {
            // end of chain processing
            IoHandler handler = getService().getIoHandler();

            if (handler != null) {
                IoHandlerExecutor executor = getService().getIoHandlerExecutor();

                if (executor != null) {
                    // asynchronous event
                    if (message == tl.get()) {
                        // copy the bytebuffer
                        if (IS_DEBUG) {
                            LOG.debug("copying bytebuffer before pushing to the executor");
                        }

                        ByteBuffer original = (ByteBuffer) message;
                        ByteBuffer clone = ByteBuffer.allocate(original.capacity());
                        // copy from the beginning
                        original.rewind();
                        clone.put(original);
                        original.rewind();
                        clone.flip();
                        executor.execute(new ReceiveEvent(this, clone));
                    } else {
                        executor.execute(new ReceiveEvent(this, message));
                    }
                } else {
                    // synchronous call (in the I/O loop)
                    handler.messageReceived(this, message);
                }
            }
        } else {
            chain[readChainPosition].messageReceived(this, message, this);
        }
View Full Code Here

TOP

Related Classes of org.apache.mina.api.IoHandler

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.