Hi!
> Instead of a database, I used an application-scoped class to track the
> data.
Instead of the application-scoped class I used the mbean stuff to gather
this information.
StandardManagerInterface standardManager =
(StandardManagerInterface)
MBeanUtils.findInstance("Catalina:host=localhost,path=/opsjs,type=Manager",
StandardManagerInterface.class);
String sessionList = standardManager.listSessionIds();
String sessionIds[] = sessionList.split(" ");
for (int i = 0; i < sessionIds.length; i++)
{
String sessionId = sessionIds[i];
lastAccessedTime =
standardManager.getLastAccessedTime(sessionId);
userInfo = standardManager.getSessionAttribute(sessionId,
"userInfo");
}
where "userInfo" is a session attribute setup by the application using a
servlet filter.
The StandardManagerInterface is a simple local interface which contains
the methods I wished to get connected to the mbean.
public interface StandardManagerInterface
{
public String listSessionIds();
public String getLastAccessedTime(String sessionId);
public String getSessionAttribute(String sessionId, String key);
}
But ok, this heavily depends on the used container. It was just a test
to play around with the mbeans in tomcat.
Ciao,
Mario