DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26503>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26503

New feature: Extend ReferenceMap with IdentityMap functionality (WeakIdentityHashMap)

           Summary: New feature: Extend ReferenceMap with IdentityMap
                    functionality (WeakIdentityHashMap)
           Product: Commons
           Version: unspecified
          Platform: All
               URL: http://developer.java.sun.com/developer/bugParade/bugs/4
                    809420.html
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Collections
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Hello All,

I would like to ask your opinion on providing IdentityMap features to 
ReferenceMap. (I am particularly interested in WeakIdentityHashMap)


Object cache is often implemented using ReferenceMap (WeakHashMap). This class 
delegates decision on when to de-cache an objects on
Java GC.

In many systems Java objects that represent database instances use database 
identity: methods Object.equals(Object) and
Object.hashCode() are redefined to use database identity (identity defined in 
terms of object table + object primary keys).

When traditional java.util.Map is used to implement database caches different 
instances of the same database objects present a problem: instances override 
each other. Class  java.util.IdentityHashMap (Apache Collections 3.0: 
IdentityMap) can be used to solve this problem - this approach uses 
System.identityHashCode() to obtain reference hashCode and Java comparison 
operator to compare keys (and values).

What I need is functionality of IdentityMap combined with WeakReference-based 
keys.

Is it possible to extend ReferenceMap with an ability to use reference identity 
instead of object identity? I can send you my prototype if you are interested 
(it adds about ten lines of code to ReferenceMap).



Here are some links to Sun's bug parade pages that describe similar feature 
request for Java's java.util.WeakHashMap:

http://developer.java.sun.com/developer/bugParade/bugs/4809420.html
http://developer.java.sun.com/developer/bugParade/bugs/4500542.html

P.S. There is a need for this feature in Apache DB-OJB project.

All the Best,
Andy

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

Reply via email to