Bugs item #634362, was opened at 2002-11-06 10:55
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=634362&group_id=22866
Category: JBossCX
Group: v3.0 Rabbit Hole
>Status: Closed
>Resolution: Fixed
Priority: 7
Submitted By: Michael Lipp (mlipp)
Assigned to: David Jencks (d_jencks)
Summary: Failure if EntityBean overrides hashCode
Initial Comment:
This is a follow on to #595738 which has not been fixed
properly.
The CachedConnectionManager uses an entity beans equals
and hashCode method to manage EJB containers. This
fails if the EJB itself overrides equals/hashCode (see
#595738 for a detailed description).
The proper solution to the problem are collection/map
implementations that use == instead of equals and
System.identityHashCode instead of hashCode.
The class IdentityWrapper which now exists in 3.0.4
does not solve the problem. It still calls hashCode on
the EJB and (as explained in the previous bug report) a
an EJB's hashCode implementation may fail if the EJB is
in the pooled state.
Worse, the current implementation actually disables
connection caching. As every object is wrapped with a
new IdentityWrapper ("key = new
IdentityWrapper(rawKey)"), the "stack.contains(key)"
will *always* fail.
----------------------------------------------------------------------
>Comment By: David Jencks (d_jencks)
Date: 2002-11-22 16:54
Message:
Logged In: YES
user_id=60525
I've fixed this in all 3 3++ branches. I think you were correct that since
the hashcode could change when the bean is pooled, the
implementation was broken.
----------------------------------------------------------------------
Comment By: Michael Lipp (mlipp)
Date: 2002-11-21 19:59
Message:
Logged In: YES
user_id=77125
Sorry, I have somehow overlooked that IdentityWrapper
overrides equals() (don't ask me how I did this :-(, it's
right above hashCode()). I withdraw the last paragraph of my
report. Again, sorry.
----------------------------------------------------------------------
Comment By: David Jencks (d_jencks)
Date: 2002-11-21 06:32
Message:
Logged In: YES
user_id=60525
I agree that using System.identityHashCode is better than using the
underlying object's hashcode ( and I will change it shortly), but I'm not at
all convinced that the current implementation is broken. In particular,
since the wrapper's equal is based on == for the underlying object, the
stack.contains(key) will work properly. If you disagree please provide
code that demonstrates your claim.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=634362&group_id=22866
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development