Robert Hubbard wrote:
>
> >From my understanding of the code an enterprise bean should have one and
> only one instance of the JBeanEntity class per PK. Thereby ensuring proper
> synchronization via the ContextSwitch class. However, if two beans make
> overlapping calls to JEntityHome.getEJBObject() and
> JEntityHome.putEJBObject() two different instances of the class can be
> created and used. It seems that only one instance gets put into the
> hashtable and is thread-safe, but the other one is never corrected, and so I
> am running into collision problems later down the road.
>
> Shouldn't putEJBObject() return the JBeanEntity (the one in the HashTable if
> a duplicate exist) so that duplicate JBeanEntity instances are not created
> and used. This seems to be a big roadblock for multiple thread access to a
> bean.
>
> Robert Hubbard
> Marathon Innovations
> (919) 462-1489
You're right. I see the problem and I will try to fix this as soon as
possible.
The problem is that the lock is inside getEJBObject or putEJBObject (to
protect
the hashtable in multithreading) so it is released between both calls.
Thank you for this very pertinent remark!
By the way, how did you find this ? Did you have problems with your
application,
or did you find this just by looking at the code ?
--
Philippe Durieux ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Bull - 1 rue de Provence - 38432 Echirolles Cedex France
[EMAIL PROTECTED]
-> Download our EJBServer at http://www.evidian.com/ejb <-
----
This list is cross-posted to two mail lists. To unsubscribe,
follow the instructions below for the list you subscribed to.
For objectweb.org: send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe ejb-container-group".
For enhydra.org: send email to [EMAIL PROTECTED] and include
in the body of the message "unsubscribe ejb-container-group".