powered by Jive Software

How to add a listener to session timeout

Hello,everyone.

I want to add a listener to listen the clientsession timeout.When the client is disconnect to openifre(for example the internet is suddenly unaccessable),the session of the client will be timeout later.And I want to get information of these timeout clientsessions.

Is there any good suggestion?

Thanks.

Try this

import org.jivesoftware.openfire.event.SessionEventDispatcher;

import org.jivesoftware.openfire.event.SessionEventListener;

public class MyClass implements SessionEventListener

{

public void init()

{

SessionEventDispatcher.addListener(this);

}

public void terminate()

{

SessionEventDispatcher.removeListener(this);

}

public void anonymousSessionCreated(Session session)

{

Log.info("anonymousSessionCreated "+ session.getAddress().toString());

}

public void anonymousSessionDestroyed(Session session)

{

Log.info("anonymousSessionDestroyed "+ session.getAddress().toString());

}

public void resourceBound(Session session)

{

Log.info("resourceBound "+ session.getAddress().toString());

}

public void sessionCreated(Session session)

{

Log.info("sessionCreated "+ session.getAddress().toString());

}

public void sessionDestroyed(Session session)

{

Log.info("sessionDestroyed "+ session.getAddress().toString());

}

}

Thanks a lot!!!