On 19/05/2011 10:30, Mateu Yabar wrote:
> Hi to all,
>
> I need to obtain the number of active sessions on the current application.
> If written the following (import org.apache.catalina.Context, import
> org.apache.catalina.Manager):
> public int getActiveSession(){
> Context context=null;
> Manager manager=context.getManager();
> return manager.getActiveSessions();
> }
>
> However I don't know who to get the current context. Is there any static
> method from which I can get it?
There is no static method.
You have two options:
- implement org.apache.catalina.ContainerServlet
- use JMX
I'd go the JMX route since ContainerServlets can't be packaged with web
applications.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]