Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] QName flyweights

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <whoschek AT lbl.gov>
  • To: Wolfgang Hoschek <whoschek AT lbl.gov>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] QName flyweights
  • Date: Fri, 10 Jun 2005 12:57:46 -0700


You just need a weak referenced Map as a cache, and use "double checking", or not, as I don't think it is that dangerous that there are two equal QNames floating around of which only one is saved in the cache...


I'm not sure I understand what you mean with "double checking" and why weak references would be significantly benefitial.

Wolfgang.

If Elliotte would like to continue supporting JDK < 1.4 we could at runtime detect what kind of Map impls are available and choose in the following order of priority:

- bounded java.util.LinkedHashMap with LRU in the way I outlined. By far the best choice wrt. reliability and performance, in my experience. (jdk >= 1.4)
- jakarta commons collections LRUHashMap or a custom stripped down version of it (jdk >= 1.2)
- java.util.WeakHashMap (jdk >= 1.2) without any bounds (not a particulary good choice, but will do the job correctly)

Wolfgang.




Archive powered by MHonArc 2.6.24.

Top of Page