]
Galder Zamarreno resolved EJBTHREE-1501.
----------------------------------------
Resolution: Cannot Reproduce Bug
We don't have a valid use case for fixing this.
Operations on cacheMap are not thread safe
------------------------------------------
Key: EJBTHREE-1501
URL:
https://jira.jboss.org/jira/browse/EJBTHREE-1501
Project: EJB 3.0
Issue Type: Sub-task
Affects Versions: AS 4.2.3.GA, 1.0.0-Beta3
Reporter: Galder Zamarreno
Assignee: Galder Zamarreno
Finally, code like this is not thread safe:
synchronized (cacheMap)
{
ctx = (StatefulBeanContext) cacheMap.get(key);
}
if(ctx == null)
throw new NoSuchEJBException("Could not find Stateful bean: " + key);
if (!ctx.isRemoved())
container.destroy(ctx);
++removeCount;
if (ctx.getCanRemoveFromCache())
{
synchronized (cacheMap)
{
cacheMap.remove(key);
}
}
This is essentiall a removeIfPresent type of operation on cacheMap and hence
get() and remove() operation, as they depend on each other, should be in a
single synchronized statement. Example:
synchronized (cacheMap)
{
ctx = (StatefulBeanContext) cacheMap.get(key);
if(ctx == null)
throw new NoSuchEJBException("Could not find Stateful bean: " +
key);
if (!ctx.isRemoved())
container.destroy(ctx);
++removeCount;
if (ctx.getCanRemoveFromCache())
{
cacheMap.remove(key);
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: