Attemping to Limit Concurrent Sessions

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Attemping to Limit Concurrent Sessions

Tim Hays

Hello,

 

Please excuse my ignorance; I am new to server configuration and particularly new to Jetty.  I am trying to deploy jetty embedded in a larger application and use jetty only as a servlet container.  I am using a single servlet from resin called Hessian to access my application from over an internal network.  My problem is that I need to limit the number of concurrent users accessing the system, and the best way I have found to do this is limit the number of sessions.  I think the best way of doing this is to write my own implementation of the sessionManager interface, which I have done, but I can’t seem to figure out how to correctly register my session manager with the server.  If anyone knows a better way to do this, or could point me to some more detailed resources than the API and Tutorials on the Jetty webpage, it would help a lot.  I am using jetty 5.1.4 and I have included my last attempt at configuring the server below.

 

                        Server server = new Server();

                       

                        SocketListener listener = new SocketListener();

                        listener.setPort(8080);

                       

                        ServletHttpContext context = new ServletHttpContext();

                        context.setContextPath("/");

                       

                        LimitSessionMgr sesMgr = new LimitSessionMgr(3);

                       

                        ServletHandler handle = new ServletHandler();

                       

                        ServletHolder Serv=handle.addServlet("gethtml","/gethtml/*","servlets.HessianServlet");

                        Serv.setInitParameter("home-class", "proofofC.DerbyServer");

                        Serv.setInitParameter("home-api", "proofofC.DerbyNetConnect");   

                       

                        // Start the http server

                        server.addListener(listener);       

                        handle.setSessionManager(sesMgr);

                        context.addHandler(handle);

                        server.addContext(context);

 

                        server.start ();

 

Thanks,

 

Tim Hays