Package org.apache.mina.common

Examples of org.apache.mina.common.SessionConfig


        }
    }
   
    private void notifyIdleSession( VmPipeSession session, long currentTime )
    {
        SessionConfig config = session.getConfig();

        notifyIdleSession0(
                session, currentTime,
                config.getIdleTimeInMillis( IdleStatus.BOTH_IDLE ),
                IdleStatus.BOTH_IDLE,
                Math.max( session.getLastIoTime(), session.getLastIdleTime( IdleStatus.BOTH_IDLE ) ) );
        notifyIdleSession0(
                session, currentTime,
                config.getIdleTimeInMillis( IdleStatus.READER_IDLE ),
                IdleStatus.READER_IDLE,
                Math.max( session.getLastReadTime(), session.getLastIdleTime( IdleStatus.READER_IDLE ) ) );
        notifyIdleSession0(
                session, currentTime,
                config.getIdleTimeInMillis( IdleStatus.WRITER_IDLE ),
                IdleStatus.WRITER_IDLE,
                Math.max( session.getLastWriteTime(), session.getLastIdleTime( IdleStatus.WRITER_IDLE ) ) );
    }
View Full Code Here


        }
    }

    private void notifyIdleSession( SocketSession session, long currentTime )
    {
        SessionConfig config = session.getConfig();

        notifyIdleSession0(
                session, currentTime,
                config.getIdleTimeInMillis( IdleStatus.BOTH_IDLE ),
                IdleStatus.BOTH_IDLE,
                Math.max( session.getLastIoTime(), session.getLastIdleTime( IdleStatus.BOTH_IDLE ) ) );
        notifyIdleSession0(
                session, currentTime,
                config.getIdleTimeInMillis( IdleStatus.READER_IDLE ),
                IdleStatus.READER_IDLE,
                Math.max( session.getLastReadTime(), session.getLastIdleTime( IdleStatus.READER_IDLE ) ) );
        notifyIdleSession0(
                session, currentTime,
                config.getIdleTimeInMillis( IdleStatus.WRITER_IDLE ),
                IdleStatus.WRITER_IDLE,
                Math.max( session.getLastWriteTime(), session.getLastIdleTime( IdleStatus.WRITER_IDLE ) ) );

        notifyWriteTimeoutSession( session, currentTime, config
                .getWriteTimeoutInMillis(), session.getLastWriteTime() );
    }
View Full Code Here

{
    private static final Logger log = LoggerFactory.getLogger( EchoProtocolHandler.class );

    public void sessionCreated( IoSession session )
    {
        SessionConfig cfg = session.getConfig();
        if( cfg instanceof SocketSessionConfig )
        {
            ( ( SocketSessionConfig ) cfg ).setSessionReceiveBufferSize( 2048 );
        }
       
        cfg.setIdleTime( IdleStatus.BOTH_IDLE, 10 );
    }
View Full Code Here

*/
public class SessionUtil
{
    public static void initialize( Session session ) throws SocketException
    {
        SessionConfig config = session.getConfig();
        if( config instanceof SocketSessionConfig )
        {
            SocketSessionConfig ssc = ( SocketSessionConfig ) config;
            ssc.setReuseAddress( true );
            ssc.setKeepAlive( true );
View Full Code Here

        }
    }

    private void notifyIdleSession( SocketSession session, long currentTime )
    {
        SessionConfig config = session.getConfig();

        notifyIdleSession0(
                session, currentTime,
                config.getIdleTimeInMillis( IdleStatus.BOTH_IDLE ),
                IdleStatus.BOTH_IDLE,
                Math.max( session.getLastIoTime(), session.getLastIdleTime( IdleStatus.BOTH_IDLE ) ) );
        notifyIdleSession0(
                session, currentTime,
                config.getIdleTimeInMillis( IdleStatus.READER_IDLE ),
                IdleStatus.READER_IDLE,
                Math.max( session.getLastReadTime(), session.getLastIdleTime( IdleStatus.READER_IDLE ) ) );
        notifyIdleSession0(
                session, currentTime,
                config.getIdleTimeInMillis( IdleStatus.WRITER_IDLE ),
                IdleStatus.WRITER_IDLE,
                Math.max( session.getLastWriteTime(), session.getLastIdleTime( IdleStatus.WRITER_IDLE ) ) );

        notifyWriteTimeoutSession( session, currentTime, config
                .getWriteTimeoutInMillis(), session.getLastWriteTime() );
    }
View Full Code Here

*/
public class EchoProtocolHandler extends IoHandlerAdapter
{
    public void sessionCreated( IoSession session )
    {
        SessionConfig cfg = session.getConfig();
        if( cfg instanceof SocketSessionConfig )
        {
            ( ( SocketSessionConfig ) cfg ).setSessionReceiveBufferSize( 2048 );
        }
    }
View Full Code Here

        }
    }

    private void notifyIdleSession( SocketSession session, long currentTime )
    {
        SessionConfig config = session.getConfig();

        notifyIdleSession0( session, currentTime, config
                .getIdleTimeInMillis( IdleStatus.BOTH_IDLE ),
                            IdleStatus.BOTH_IDLE, session.getLastIoTime() );
        notifyIdleSession0( session, currentTime, config
                .getIdleTimeInMillis( IdleStatus.READER_IDLE ),
                            IdleStatus.READER_IDLE, session.getLastReadTime() );
        notifyIdleSession0( session, currentTime, config
                .getIdleTimeInMillis( IdleStatus.WRITER_IDLE ),
                            IdleStatus.WRITER_IDLE, session.getLastWriteTime() );

        notifyWriteTimeoutSession( session, currentTime, config
                .getWriteTimeoutInMillis(), session.getLastWriteTime() );
    }
View Full Code Here

                            it.remove();
                        }
                        else
                        {
                            long idleTime;
                            SessionConfig config = session.getConfig();

                            if( !session.isIdle( IdleStatus.BOTH_IDLE ) )
                            {
                                idleTime = config
                                        .getIdleTimeInMillis( IdleStatus.BOTH_IDLE );
                                session.setIdle( IdleStatus.BOTH_IDLE,
                                                 idleTime > 0L
                                                 && ( currentTime - session.getLastIoTime() ) > idleTime );
                                if( session.isIdle( IdleStatus.BOTH_IDLE ) )
                                    session.getManagerFilterChain()
                                            .sessionIdle( session,
                                                          IdleStatus.BOTH_IDLE );
                            }

                            if( !session.isIdle( IdleStatus.READER_IDLE ) )
                            {
                                idleTime = config
                                        .getIdleTimeInMillis( IdleStatus.READER_IDLE );
                                session.setIdle( IdleStatus.READER_IDLE,
                                                 idleTime > 0L
                                                 && ( currentTime - session.getLastReadTime() ) > idleTime );
                                if( session.isIdle( IdleStatus.READER_IDLE ) )
                                    session.getManagerFilterChain()
                                            .sessionIdle( session,
                                                          IdleStatus.READER_IDLE );
                            }

                            if( !session.isIdle( IdleStatus.WRITER_IDLE ) )
                            {
                                idleTime = config
                                        .getIdleTimeInMillis( IdleStatus.WRITER_IDLE );
                                session.setIdle( IdleStatus.WRITER_IDLE,
                                                 idleTime > 0L
                                                 && ( currentTime - session.getLastWriteTime() ) > idleTime );
                                if( session.isIdle( IdleStatus.WRITER_IDLE ) )
View Full Code Here

*/
public class SessionUtil
{
    public static void initialize( Session session ) throws SocketException
    {
        SessionConfig config = session.getConfig();
        if( config instanceof SocketSessionConfig )
        {
            SocketSessionConfig ssc = ( SocketSessionConfig ) config;
            ssc.setReuseAddress( true );
            ssc.setKeepAlive( true );
View Full Code Here

        }
    }
   
    private void notifyIdleSession( VmPipeSession session, long currentTime )
    {
        SessionConfig config = session.getConfig();

        notifyIdleSession0(
                session, currentTime,
                config.getIdleTimeInMillis( IdleStatus.BOTH_IDLE ),
                IdleStatus.BOTH_IDLE,
                Math.max( session.getLastIoTime(), session.getLastIdleTime( IdleStatus.BOTH_IDLE ) ) );
        notifyIdleSession0(
                session, currentTime,
                config.getIdleTimeInMillis( IdleStatus.READER_IDLE ),
                IdleStatus.READER_IDLE,
                Math.max( session.getLastReadTime(), session.getLastIdleTime( IdleStatus.READER_IDLE ) ) );
        notifyIdleSession0(
                session, currentTime,
                config.getIdleTimeInMillis( IdleStatus.WRITER_IDLE ),
                IdleStatus.WRITER_IDLE,
                Math.max( session.getLastWriteTime(), session.getLastIdleTime( IdleStatus.WRITER_IDLE ) ) );
    }
View Full Code Here

TOP

Related Classes of org.apache.mina.common.SessionConfig

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.