Package org.apache.mina.transport.socket.nio

Examples of org.apache.mina.transport.socket.nio.SocketSessionConfig


*/
public class SessionUtil {
    public static void initialize(IoSession session) {
        IoSessionConfig cfg = session.getConfig();
        if (cfg instanceof SocketSessionConfig) {
            SocketSessionConfig sCfg = (SocketSessionConfig) cfg;
            sCfg.setKeepAlive(true);
        }
    }
View Full Code Here


        this.listener = listener;
        this.filter = filter;
        this.session = session;

        if (session.getTransportType() == TransportType.SOCKET) {
            SocketSessionConfig cfg = (SocketSessionConfig) session.getConfig();
            cfg.setTcpNoDelay(true);
        }
    }
View Full Code Here

    public static void initialize( IoSession session )
    {
        IoSessionConfig cfg = session.getConfig();
        if( cfg instanceof SocketSessionConfig )
        {
            SocketSessionConfig sCfg = ( SocketSessionConfig ) cfg;
            sCfg.setReuseAddress( true );
            sCfg.setKeepAlive( true );
        }
        else if( cfg instanceof DatagramSessionConfig )
        {
            DatagramSessionConfig dCfg = ( DatagramSessionConfig ) cfg;
            dCfg.setReuseAddress( true );
View Full Code Here

            _acceptor = new org.apache.mina.transport.socket.nio.SocketAcceptor(_processors, new NewThreadExecutor());
        }

        SocketAcceptorConfig sconfig = (SocketAcceptorConfig) _acceptor.getDefaultConfig();
        sconfig.setThreadModel(ExecutorThreadModel.getInstance("MINANetworkDriver(Acceptor)"));
        SocketSessionConfig sc = (SocketSessionConfig) sconfig.getSessionConfig();

        if (config != null)
        {
            sc.setReceiveBufferSize(config.getReceiveBufferSize());
            sc.setSendBufferSize(config.getSendBufferSize());
            sc.setTcpNoDelay(config.getTcpNoDelay());
        }

        if (sslFactory != null)
        {
            _sslFactory = sslFactory;
View Full Code Here

                    break;
                }
            }
        cfg.setThreadModel(ExecutorThreadModel.getInstance("MINANetworkDriver(Client)-"+s));

        SocketSessionConfig scfg = (SocketSessionConfig) cfg.getSessionConfig();
        scfg.setTcpNoDelay((config != null) ? config.getTcpNoDelay() true);
        scfg.setSendBufferSize((config != null) ? config.getSendBufferSize() : DEFAULT_BUFFER_SIZE);
        scfg.setReceiveBufferSize((config != null) ? config.getReceiveBufferSize() : DEFAULT_BUFFER_SIZE);

        // Don't have the connector's worker thread wait around for other
        // connections (we only use
        // one SocketConnector per connection at the moment anyway). This allows
        // short-running
View Full Code Here

    {
        try
        {
            IoAcceptor acceptor = new SocketAcceptor();
            SocketAcceptorConfig sconfig = (SocketAcceptorConfig) acceptor.getDefaultConfig();
            SocketSessionConfig sc = (SocketSessionConfig) sconfig.getSessionConfig();

            sc.setReceiveBufferSize(connectorConfig.socketReceiveBufferSize);
            sc.setSendBufferSize(connectorConfig.socketWriteBuferSize);
            sc.setTcpNoDelay(true);

            // if we do not use the executor pool threading model we get the default leader follower
            // implementation provided by MINA
            if (connectorConfig.enableExecutorPool)
            {
View Full Code Here

            _acceptor = new org.apache.mina.transport.socket.nio.SocketAcceptor(_processors, new NewThreadExecutor());
        }

        SocketAcceptorConfig sconfig = (SocketAcceptorConfig) _acceptor.getDefaultConfig();
        sconfig.setThreadModel(ExecutorThreadModel.getInstance("MINANetworkDriver(Acceptor)"));
        SocketSessionConfig sc = (SocketSessionConfig) sconfig.getSessionConfig();

        if (config != null)
        {
            sc.setReceiveBufferSize(config.getReceiveBufferSize());
            sc.setSendBufferSize(config.getSendBufferSize());
            sc.setTcpNoDelay(config.getTcpNoDelay());
        }

        if (sslFactory != null)
        {
            _sslFactory = sslFactory;
View Full Code Here

                    break;
                }
            }
        cfg.setThreadModel(ExecutorThreadModel.getInstance("MINANetworkDriver(Client)-"+s));

        SocketSessionConfig scfg = (SocketSessionConfig) cfg.getSessionConfig();
        scfg.setTcpNoDelay((config != null) ? config.getTcpNoDelay() true);
        scfg.setSendBufferSize((config != null) ? config.getSendBufferSize() : DEFAULT_BUFFER_SIZE);
        scfg.setReceiveBufferSize((config != null) ? config.getReceiveBufferSize() : DEFAULT_BUFFER_SIZE);

        // Don't have the connector's worker thread wait around for other
        // connections (we only use
        // one SocketConnector per connection at the moment anyway). This allows
        // short-running
View Full Code Here

        socketAcceptorConfig.setReuseAddress(true);
        // Set the listen backlog (queue) length. Default is 50.
        socketAcceptorConfig.setBacklog(JiveGlobals.getIntProperty("xmpp.socket.backlog", 50));

        // Set default (low level) settings for new socket connections
        SocketSessionConfig socketSessionConfig = socketAcceptorConfig.getSessionConfig();
        //socketSessionConfig.setKeepAlive();
        int receiveBuffer = JiveGlobals.getIntProperty("xmpp.socket.buffer.receive", -1);
        if (receiveBuffer > 0 ) {
            socketSessionConfig.setReceiveBufferSize(receiveBuffer);
        }
        int sendBuffer = JiveGlobals.getIntProperty("xmpp.socket.buffer.send", -1);
        if (sendBuffer > 0 ) {
            socketSessionConfig.setSendBufferSize(sendBuffer);
        }
        int linger = JiveGlobals.getIntProperty("xmpp.socket.linger", -1);
        if (linger > 0 ) {
            socketSessionConfig.setSoLinger(linger);
        }
        socketSessionConfig.setTcpNoDelay(
                JiveGlobals.getBooleanProperty("xmpp.socket.tcp-nodelay", socketSessionConfig.isTcpNoDelay()));
        return socketAcceptor;
    }
View Full Code Here

                _logger.warn("Using Mina IO Processing");
                acceptor = new org.apache.mina.transport.socket.nio.SocketAcceptor(config.getProcessors(), new NewThreadExecutor());
            }
           
            SocketAcceptorConfig sconfig = (SocketAcceptorConfig) acceptor.getDefaultConfig();
            SocketSessionConfig sc = (SocketSessionConfig) sconfig.getSessionConfig();

            sc.setReceiveBufferSize(config.getReceiveBufferSize());
            sc.setSendBufferSize(config.getWriteBufferSize());
            sc.setTcpNoDelay(config.getTcpNoDelay());

            // if we do not use the executor pool threading model we get the default leader follower
            // implementation provided by MINA
            if (config.getEnableExecutorPool())
            {
View Full Code Here

TOP

Related Classes of org.apache.mina.transport.socket.nio.SocketSessionConfig

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.