Thanks Ronald and Pid for the help. Honestly I don't know if this parameters thing is really a performance issue, but I've been assigned to work on it so I don't have much choice, ;).
I liked the idea of a class handling the attributes in ServletContext. I'll give it a try and let you know of the outcome. Thanks again. Best regards, Federico Alvarez. Lic. Federico Alvarez Analista Genexus ········································································ GEOCOM Uruguay S.A. Dionisio Oribe 3071 // Montevideo CP 11600 // Uruguay Tels.: (+598) 2 481 7777 ext. 775 / Fax.: 481 7777 ext. 718 EnGEOCOM nos comprometemos con el Medio Ambiente: Antes de imprimir este e-mail piense bien si es necesario. NOTA DE CONFIDENCIALIDAD: La informacion transmitida en este mensaje y sus archivos adjuntos son para la persona o entidad a la cual esta dirigida y puede contener material privilegiado y/o confidencial. Su transmision se encuentra legalmente protegida. Si usted ha recibido este e-mail por error, comuniquelo inmediatamente por esta via su autor y eliminelo de su sistema. Si usted no es el destinatario especificado en el mensaje, cualquier revelacion copia o distribucion de su contenido esta estrictamente prohibida. Es responsabilidad del receptor asegurarse que el mensaje y sus archivos adjuntos se encuentren libres de virus. El mensaje expresa la opinion de su autor pero no necesariamente la de GEOCOM Uruguay S.A. Ni GEOCOM Uruguay S.A ni su autor se hacen responsables por las alteraciones que pueda sufrir este mensaje a partir de su envio. -----Mensaje original----- De: Pid [mailto:p...@pidster.com] Enviado el: jueves, 28 de octubre de 2010 19:36 Para: Tomcat Users List Asunto: Re: RV: Session & Context variables architecture problem On 28/10/2010 18:31, falva...@geocom.com.uy wrote: > Dear All, > I'm currently using Tomcat 6.0.28 and having some > doubt on how to solve and implement this problem: > My webapp has a MySQL Database with a > table named "parameters", in which we have just two columns > ("property" and "value"). This table is acceded many times but doesn't change > often. > > For performance purposes I want to save > this parameters in the user's tomcat session, so they are read from > memory and not database. So far so good. Do you actually know that this is a performance problem, or are you guessing that it is? > Now the problem: how can I tell this > sessions that an attribute has changed? Using the session will mean that you have duplicate copies of this information in each session. > I had suggestions of using "context variables" instead > of "session variables", but that didn't solve the problem. *If* you need to do this, using the Context is probably better. I would suggest that you created a class which periodically updated all the values by selecting the data in the DB and storing the result in the Context. Implementing a ServletContextListener will give you access to the ServletContext and two methods, for app startup & shutdown, which you can use to start the periodic process, and properly stop it (very important). You may consider using a Timer, or something from the java.util.concurrent package. p > Any help in this matter is more than welcome. I have no problem in > changing the approach, and may be not use sessions at all. > > Thanks in advance. > > Best regards, > > Federico Alvarez. > > Info: > > Tomcat 6.0.28 > Java 1.6 > MySQL 5.5 > > NOT USING HIBERNATE, so 2nd Level cache is not an > option --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org