on 3/13/02 2:51 PM, "James Taylor" <[EMAIL PROTECTED]> wrote:
> Sorry, I wasn't clear at all,
>
> Consider the class in question: org.apache.stratum.jcs.JCS
>
> protected static void ensureCacheManager()
> {
> if ( cacheMgr == null )
> {
> synchronized ( GroupCacheAccess.class )
> {
> if ( cacheMgr == null )
> {
> if ( configFilename == null )
> {
> cacheMgr = GroupCacheManagerFactory.getInstance();
> }
> else
> {
> cacheMgr = GroupCacheManagerFactory
> .getInstance( configFilename );
> }
> }
> }
> }
> }
>
> public static void setConfigFilename( String configFilename )
> {
> JCS.configFilename = configFilename;
> }
>
> So we need to be able to call getFilename and then ensureCacheManager
> later. Of course, there are other problems here, a change in
> architecture might be a better way to work around this concern. As we
> work on more runtime configuration flexibility I think we will be able
> to find a better solution. For now removing the double check and making
> ensureCacheManager synchronized seems like the safest option.
Yes, the above looks like bad design. I didn't realize the scope of it. :-)
> That can't possibly be true for a static variable. My understanding is
> that static initialization is done at the time of first active use,
> which is too early for the above to work unfortunately.
Ah...yes...true...
-jon
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>