[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ResourceBundle optimisation

From: Bryce McKinlay
Subject: Re: ResourceBundle optimisation
Date: Fri, 08 Jul 2005 15:48:29 -0400
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)

Thomas Zander wrote:

I'm pretty sure its not an API design to disallow this. So its implementation specific and your argument that Sun does not do it is indeed a pretty strong one. I'm not sure I agree with it, but its a good argument nontheless.

My original point still stands; loading "" while "" was requested will effectively make it impossible to find foo_nl* if its placed in the classpath later. Which is definitely not what I expect.

Tomcat and other servers implement re-loading of existing classes by loading them into a new ClassLoader. This way, old instances of the classes will be garbage collected when their ClassLoader becomes unreachable.

Resources work in the same way: ResourceBundles are cached per-ClassLoader, so modified bundles will be reloaded if getBundle() is called from a class loaded by a new ClassLoader.

I have not confirmed that this is the behaviour you get from Sun's implementation, but I suspect it is. I also think it provides a good balance between caching performance and the flexibility to reload things in a long-running server. getBundle() is called a lot, so it should be very fast in the common case - ideally avoiding allocations or making system calls.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]