classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] [RFA/JDWP] ReferenceKey


From: Archie Cobbs
Subject: Re: [cp-patches] [RFA/JDWP] ReferenceKey
Date: Sun, 19 Jun 2005 17:49:43 -0500
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129

Keith Seitz wrote:
One minor snafu -- maybe someone sees a way around this.

In order to facilitate the two types of needed lookups, we keep around
the two tables I mentioned:

oidTable maps from Object (ReferenceKey) to ObjectId
idTable maps from Long (numerical ID) to ObjectId

iodTable is used by the back-end and the VM parts to query IDs for
Objects to be passed to the debugger. idTable is for looking up objects
from commands sent by the debugger.

Whatever the table type (Hashtable or WeakHashMap), I would need to keep
a ReferenceQueue of the garbage collected Objects in order to clear the
IDs from garbage collected Objects from idTable.

Unfortunately, with the WeakHashMap, there is no way to get the keys put
into a ReferenceQueue (that I can see at least). Consequently, I'll
never know when to clean up the idTable unless I iterate over the table,
asking each ID whether its object is still valid.

So if I am to continue to use two tables for lookups, I need a little
more control over the garbage collection of keys than WeakHashMap
affords me, I think.

Seems you're right.. it sounds a bit more complicated than a simple
weak-key hash map would allow. Makes for an interesting programming
exercise then.. :-)

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]