----- Original Message -----
From: "Michael A. Smith" <[EMAIL PROTECTED]>
To: "Jakarta Commons Developers List" <[EMAIL PROTECTED]>;
"Morgan Delagrange" <[EMAIL PROTECTED]>
Sent: Thursday, February 14, 2002 3:49 PM
Subject: Re: [Collections] subclassing LRUMap


> On Thu, 14 Feb 2002, Morgan Delagrange wrote:
> > I just made a backward-compatible change to LRUMap to facilitate
> > subclassing.  Now, you can override removeLRU() if you want to
manipulate
> > (e.g. persist to disk) an Object before it is automatically removed from
the
> > Map.  You can also subclass remove(Object) if you want to manipulate all
> > Objects before they are removed, whether or not they are being removed
by
> > the LRU algorithm.
> >
> > This seemed like a pretty reasonable thing to do, but I wanted to drop a
> > note to the list since it enhances the contract of LRUMap.  Let me know
if
> > you object to the idea or the approach.
>
> Actually, I just object to the implementation of LRUMap itself.  Many of
> its operations have O(n) cost when they could be O(1).  I haven't taken a
> good look at the changes you've made, but it doesn't look like you've
> fixed that.  :)

No, the changes I've made recently were mainly to fix bugs and allow more
control in subclasses.  If anything, I've made the class slightly less
performant for put(Object,Object) operations.

> I'll try to take a closer look at what you've changed
> when I have a few spare cycles (possibly not until this weekend).

Yeah, there are longer-term issues with LRUMap, particularly wrt. its
effectiveness of its algorithm as a cache.  I'll launch this in a separate
thread soon.  I'm going to need to write more unit tests, because any
changes I make should try to be compatible with previous externalized
versions, or they can't be made in a 1.x version of Collections (Collections
has already performed an official 1.0 release).  (We really should have had
a unit test for externalized versions before I started making changes, but
there were some outright bugs that needed attention.)

> I don't know if you saw these other messages talking about LRUMap
> (there's more, I just selected a couple):
>
> http://www.mail-archive.com/commons-dev@jakarta.apache.org/msg02555.html
> http://www.mail-archive.com/commons-dev@jakarta.apache.org/msg03084.html
>

Yup I've seen them.  James quoted the relevant portions in his Javadocs.

> Oh, and since you seem to have an active interest in collections (no one
> else seems to), maybe you could review the patches I've submitted that
> have not yet been applied?
>
> http://www.mail-archive.com/commons-dev@jakarta.apache.org/msg03055.html
> http://www.mail-archive.com/commons-dev@jakarta.apache.org/msg03056.html
> http://www.mail-archive.com/commons-dev@jakarta.apache.org/msg03057.html
> http://www.mail-archive.com/commons-dev@jakarta.apache.org/msg03060.html

I may take a look, but right now I'm just focusing on LRUMap.  I plan to
implement a cache with it.

> I was planning on "fixing" LRUMap once the SequencedHashMap patch was
> applied.  I also plan on adding a ton of test cases as well (for all Map
> implementations).  I mentioned that here:
>
> http://www.mail-archive.com/commons-dev@jakarta.apache.org/msg03054.html
>
> I've got quite a few done, but its not nearly as complete as I'd like.

I've added several unit tests for LRUMap, mainly to illustrate bugs before I
committed the fix.

- Morgan


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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

Reply via email to