Search code examples
javanetwork-programmingapache-mina

Session management/monitoring in Apache mina


Is there a (built in) way to monitor sessions in apache mina. I want to keep track of total session active whenever a session is created/closed.

I know i can do it by keeping references of all the incoming session in my IoHandlerAdapter and remove one when the session is closed. I am looking for a built in way of doing it.


Solution

  • only monitor session create/close?

    you need implement a IoServiceListener,call ioService.addListener.

    whenever a session created/closed event happens ,your IoServiceListenerImplClass gets the event call

    see

    http://mina.apache.org/mina-project/apidocs/org/apache/mina/core/service/IoServiceListener.html

    http://mina.apache.org/report/trunk/apidocs/org/apache/mina/core/service/IoServiceListener.html