-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Anyone? Thanks in advance!

On 7/14/2010 10:16 AM, Christopher Schultz wrote:
> All,
> 
> I've looked through the archives to see if there's a way to do this, and
> I feel like there must be an easier way, so I'll ask again.
> 
> I'm using Struts 1.3.8 in a webapp deployed on Tomcat 6.0, and I'd like
> to reload my own MessageResource objects on demand (say, when I have to
> change a .properties file in production for some reason). I'd prefer to
> avoid an app reload if possible.
> 
> I tried the simplest thing I could come up with, which was this:
> 
>   MessageResourcesFactory mrf = MessageResourcesFactory.createFactory();
>   MessageResources mr = mrf.createResources("MyResources");
> 
> This gives me two unique objects every time I execute the code (that is,
> the hashcodes change), but mr.getMessage("foo") always returns the
> string that was (apparently) originally loaded.
> 
> I also tried doing this:
> 
> MessageResourcesFactory.setFactoryClass(MessageResourcesFactory.getFactoryClass());
>   MessageResourcesFactory mrf = MessageResourcesFactory.createFactory();
>   MessageResources mr = mrf.createResources("MyResources");
> 
> The idea here was that I might be able to force a flush of some kind of
> cached object, but this doesn't help, either.
> 
> I've been looking at the code for 1.3.8 for MessageResourcesFactory,
> MessageResources, and their Property* counterparts, and it doesn't look
> like any caching is being performed in these classes.
> 
> The archives say that forcing a reload requires a replacement
> implementation of MessageResourcesFactory, but I can't see why that's
> necessary.
> 
> Could it be that the ClassLoader provided by Tomcat is caching the
> contents of the properties file, and I'm not getting my updates because
> of that?
> 
> I'd love an explanation for this.
> 
> Thanks,
> -chris

- ---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxAua4ACgkQ9CaO5/Lv0PDGrgCeOs+gat5Ulks9BXo74on0XmzF
u4MAoIPUrKiuTOe0Q6rcT5lA3wPUxHYp
=zxt2
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to