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

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


        if (readWriteThreading)
        {
            cfg.setThreadModel(new ReadWriteThreadModel());
        }

        SocketSessionConfig scfg = (SocketSessionConfig) cfg.getSessionConfig();
        scfg.setTcpNoDelay("true".equalsIgnoreCase(System.getProperty("amqj.tcpNoDelay", "true")));
        scfg.setSendBufferSize(Integer.getInteger("amqj.sendBufferSize", DEFAULT_BUFFER_SIZE));
        _logger.info("send-buffer-size = " + scfg.getSendBufferSize());
        scfg.setReceiveBufferSize(Integer.getInteger("amqj.receiveBufferSize", DEFAULT_BUFFER_SIZE));
        _logger.info("recv-buffer-size = " + scfg.getReceiveBufferSize());
        final InetSocketAddress address = new InetSocketAddress(brokerDetail.getHost(), brokerDetail.getPort());
        protocolHandler.setUseSSL(brokerDetail.useSSL());
        _logger.info("Attempting connection to " + address);
        ConnectFuture future = ioConnector.connect(address, protocolHandler);
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

    {
        _logger.info("Connecting to cluster peer: " + getDetails());
        SocketConnector ioConnector = new SocketConnector();
        SocketConnectorConfig cfg = (SocketConnectorConfig) ioConnector.getDefaultConfig();

        SocketSessionConfig scfg = (SocketSessionConfig) cfg.getSessionConfig();
        scfg.setTcpNoDelay(true);
        scfg.setSendBufferSize(32768);
        scfg.setReceiveBufferSize(32768);
        InetSocketAddress address = new InetSocketAddress(getHost(), getPort());
        return ioConnector.connect(address, _binding);
    }
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

        this.serviceAddress = serviceAddress;
       
        // Apply the initial session settings
        if( config instanceof SocketSessionConfig )
        {
            SocketSessionConfig cfg = ( SocketSessionConfig ) config;
            this.config.setKeepAlive( cfg.isKeepAlive() );
            this.config.setOobInline( cfg.isOobInline() );
            this.config.setReceiveBufferSize( cfg.getReceiveBufferSize() );
            this.readBufferSize = cfg.getReceiveBufferSize();
            this.config.setReuseAddress( cfg.isReuseAddress() );
            this.config.setSendBufferSize( cfg.getSendBufferSize() );
            this.config.setSoLinger( cfg.getSoLinger() );
            this.config.setTcpNoDelay( cfg.isTcpNoDelay() );

            if( this.config.getTrafficClass() != cfg.getTrafficClass() )
            {
                this.config.setTrafficClass( cfg.getTrafficClass() );
            }
        }
    }
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

        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

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

        SocketAcceptorConfig sconfig = (SocketAcceptorConfig) _acceptor.getDefaultConfig();
        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

            org.apache.mina.common.ByteBuffer.setAllocator(new SimpleByteBufferAllocator());
        }

        SocketConnectorConfig cfg = (SocketConnectorConfig) _socketConnector.getDefaultConfig();
       
        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

*/
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

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.