Friday, January 31, 2003 4:20 PM , Adolfo Miguelez
<[EMAIL PROTECTED]> a écrit :
> I agree. But, could the hashtable be collected before since it has not
> references in the method? Or is
>
> TemplatesCache.getInstance().get("key");
>
> considered as a reference?

If you use the Sigleton D.P. as it must be, I don't see any reason that your
hashtable be collected for the durring of the VM.

The siglton does'nt need the *Class* to be static but the *instance*
attribute. So as soon as you do .getInstance(), the instance attribute of
TemplateCache is affected to a new TemplatesCache and will stay as long as
the app live if you don't don't re-affect 'instance' to another object (but
you must not).

By the way and to come back to the true subject of the list , I coded such a
cache for xslt Templates, but I don't make it a singleton as I want severals
caches for each struts module context. So the unicity of each instance is
managed via a hashtable referenced in the ServletContext by a key like
"TemplatesCaches".

Malik.






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to