commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Stansberry <>
Subject logging: WeakHashtable
Date Thu, 11 Nov 2004 07:40:24 GMT
Hi Robert,
Had a little time to look at the WeakHashtable.  Much cleaner w/o reflection!
A couple things occurred to me as I looked.
1)  The instances of Referenced are not cleared from the underlying table if their underlying
references are cleared.
2)  Passing null keys/values to put() does not result in a NPE.
I attached a patch to the WeakHashtableTest that tests for these.
One thought on #1 is to make Referenced a subclass of WeakReference instead of a wrapper.
 You can then keep a ReferenceQueue and poll it to remove cleared references from the hashtable
whenever get() is called.  This is similar to what WeakHashMap does.
Brian Stansberry

Do you Yahoo!?
 Check out the new Yahoo! Front Page.
View raw message