ubaggili wrote:
> Hello Everyone,
>
> I am in the process of upgrading an application that I am still writing to
> use Mina 2.0.  I managed to resolve most changes except for one.  I searched
> the forum but I haven't found an existing answer.
>
> My Handler extends IoHandlerAdapter and overrides 2 methods:
>
>     public void sessionCreated(IoSession session) throws Exception {
>         if (session.getTransportType() == TransportType.SOCKET)   //<=====
> How do I do this in Mina 2.0?
>             ((SocketSessionConfig)
> session.getConfig()).setReceiveBufferSize(2048);
>         session.setIdleTime(IdleStatus.BOTH_IDLE, 10);               
> //====> what is the new way to setIdleTime(x,x) on the session?
>     }
>
> Thanks in advance,
> Ussama
>
>   
Just test if session is an instance of SocketSession:

if (session instanceof SocketSession) {
  ((SocketSessionConfig) session.getConfig()).setReceiveBufferSize(2048);
}
session.getConfig().setIdleTime(...);

Seems like setIdleTime() has moved to IoSessionConfig.

HTH

-- 
Niklas Therning
www.spamdrain.net

Reply via email to