This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]