Actually, an ideal implementation in this case would be a JDK1.3 version of
a "LinkedConcurrentHashMap", based on both the JDK1.4
java.util.LinkedHashMap and the JDK1.5
java.util.concurrent.ConcurrentHashMap, taking advantage of both the
features and benefits of LinkedHashMap in LRUMemoryCache, and achieving an
order of magnitude better concurrency.

But then coming up with a correct JDK1.3 version of the LinkedHashMap is
probably also an order of magnitude easier than coming up with a correct
"LinkedConcurrentHashMap".

Hanson
  -----Original Message-----
  From: Hanson Char [mailto:[EMAIL PROTECTED]
  Sent: Saturday, 19 June 2004 9:45 PM
  To: 'Turbine JCS Developers List'
  Subject: RE: LRUMemoryCache


  >Perhaps we need to stay compatible with J2SDK 1.3.
  >A lot of projects on the ASF stick to this requirement.
  >BTW, in jakarta commons collections we have:

>http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_0/org/a
pache/commons/collections/map/LinkedMap.html
  >I am not sure if this can be used and if this works in 1.3.

  Unfortunately, the LinkedMap in jakarta-commons collections has the
limitation that (extracted from the javadoc):

      "In this implementation order is maintained by original insertion."

  where as the LinkedHashMap in JDK1.4+:

      "A special constructor is provided to create a linked hash map whose
order of iteration is the order in which its entries were last accessed,
from least-recently accessed to most-recently (access-order)."

  Also, from the javadoc of LinkedMap:

      "This implementation improves on the JDK1.4 LinkedHashMap by adding
the MapIterator functionality, additional convenience methods and allowing
bidirectional iteration."

  but it doesn't mention about the loss of the "LRU" functionality from the
JDK1.4 LinkedHashMap!

  It seems to be an easy task to provide a JDK1.3 compatible version of
LinkedHashMap based on the JDK1.4 implementation.  Or does it need to be an
absolute clean-room re-implementation of the JDK1.4 LinkedHashMap
functionalities in order to avoid any licensing issue ?

  Hanson

Reply via email to