You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by christopher marshall <ox...@hotmail.com> on 2002/05/17 13:03:57 UTC

SoftRefHashMap isn't a pure implementation of Map - I'd like to contribute one

All -

Again you may have to excuse my naivety. The 
org.apache.common.collections.SoftRefHashMap is not a "pure" implementation 
of the java.util.Map interface, because the collections returned by the 
"values()" and "entrySet()" methods are not backed by the underlying Map. I 
also believe that the SoftRefHashMap is flawed as keys will not be 
automatically be reclaimed when their value-referents are cleared - the user 
has to manually invoke the purge() method.

I have written an implementation of Map (SoftValueHashMap) which is a pure 
implementation of the java.util.Map interface and which purges itw own keys 
automatically. Also it has a getIfAbsentPut(Object key, ObjectFactory fac) 
method, which is very useful for cache-ing purposes (it is unlikely that a 
Cache will want to return "null" just because an underlying value has been 
de-referenced etc).

I wish to contribute this code to Apache Commons Collections and have been 
looking on the Apache site to see how this is done by a new developer. 
Unforunately I can't find the information. Could someone please tell me the 
etiquette to be followed (presumably I email my source code to an "Admitter" 
who puts it in the nightly-release CVS repository.

Thanks in advance,

Chris Marshall


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: SoftRefHashMap isn't a pure implementation of Map - I'd like to contribute one

Posted by "Michael A. Smith" <ma...@apache.org>.
On Fri, 17 May 2002, christopher marshall wrote:
> Again you may have to excuse my naivety. The 
> org.apache.common.collections.SoftRefHashMap is not a "pure" implementation 
> of the java.util.Map interface, because the collections returned by the 
> "values()" and "entrySet()" methods are not backed by the underlying Map. I 
> also believe that the SoftRefHashMap is flawed as keys will not be 
> automatically be reclaimed when their value-referents are cleared - the user 
> has to manually invoke the purge() method.
> 
> I have written an implementation of Map (SoftValueHashMap) which is a pure 
> implementation of the java.util.Map interface and which purges itw own keys 
> automatically. Also it has a getIfAbsentPut(Object key, ObjectFactory fac) 
> method, which is very useful for cache-ing purposes (it is unlikely that a 
> Cache will want to return "null" just because an underlying value has been 
> de-referenced etc).

I think we'd much rather have the existing SoftRefHashMap patched to be 
correct.  

> I wish to contribute this code to Apache Commons Collections and have been 
> looking on the Apache site to see how this is done by a new developer. 
> Unforunately I can't find the information. Could someone please tell me the 
> etiquette to be followed (presumably I email my source code to an "Admitter" 
> who puts it in the nightly-release CVS repository.

other than fixing the above mentioned problems, how different is it?  
Could you just patch the existing version?  

Anyway, the correct procedure is to submit it here (preferrably as a 
patch with the subject prefixed with [PATCH]).  See also: 
http://jakarta.apache.org/site/getinvolved.html
http://jakarta.apache.org/site/source.html

regards,
michael


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>