OK, thanks. ADC
-----Original Message----- From: Frode E. Moe [mailto:[EMAIL PROTECTED] Sent: 08 January 2004 09:57 To: Tomcat Users List Subject: Re: Static ints being cached On Thu, Jan 08, 2004 at 09:53:14 -0000, Allistair Crossley wrote: > Hi All, > > I have an interface containing public final static ints. My servlets reference these > ints when making database inserts. Yesterday I reordered the values of the ints and > noticed that old values were still being placed into the database. I guess this was > somehow a caching problem. I deleted the .class from Tomcat to ensure a recompile > would place a new .class and restarted Tomcat, but old values still went in the > database! > > - If I output the static ints from a JSP the new values come out. > - If I output the static ints from a class the old values come out. > - If I force the class using the interface to recompile, then the class starts using > the new values > > It seems that somehow references are being stored by Tomcat somewhere since a > restart does not work but I don't know much about this. I would like to trust that > when I change values that Tomcat is able to pick these up, at the very least on a > restart!! I don't want to go through recompiling my whole app. > > I am using Ant in a multi-developer environment to compile and it compiles only > classes that have changed. I cannot recompile the whole app everytime I change > constant values. > > Help and understanding appreciated ... The values of static final ints are copied into classes referring to those as an optimization by the java compiler. So if you have class A with some public static final ints in, and a class B referencing these values, you will need to recompile class B if you change class A. Or you need to make them non-final, so that java will actually look at the current values in class A every time. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> ------------------------------------------------------- QAS Ltd. Developers of QuickAddress Software <a href="http://www.qas.com">www.qas.com</a> Registered in England: No 2582055 Registered in Australia: No 082 851 474 ------------------------------------------------------- </FONT> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
