[jboss-jira] [JBoss JIRA] Created: (EJBTHREE-1500) Discrepancies between removing a bean in cache vs bean passivated

Galder Zamarreno (JIRA) jira-events at lists.jboss.org
Tue Sep 23 11:35:20 EDT 2008


Discrepancies between removing a bean in cache vs bean passivated
-----------------------------------------------------------------

                 Key: EJBTHREE-1500
                 URL: https://jira.jboss.org/jira/browse/EJBTHREE-1500
             Project: EJB 3.0
          Issue Type: Sub-task
    Affects Versions: AS 4.2.3.GA, AS 5.0.0.CR1
            Reporter: Galder Zamarreno
            Assignee: Galder Zamarreno


There's a discrepancy between removing a bean from the cache 
after a timeout when bean is in cache compared to when bean is 
passivated:

Example, when bean is in cache and has to be removed, this is called:

if (now - centry.lastUsed >= removalTimeout * 1000)
{
  synchronized (centry)
  {                                                                    
    it.remove();
  }
}

Now, when bean is passivated, this is called:

if (now - centry.lastUsed >= removalTimeout * 1000)
{
  get(centry.getId(), false);
  remove(centry.getId());
}   

And remove() method calls:

      if(log.isTraceEnabled())
      {
         log.trace("Removing context " + key);
      }
      StatefulBeanContext ctx = null;
      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);
         }
      }

What this means is that when a bean in cache is removed:

1.- removeCount is not updated

2.- container.destroy(ctx); is not executed and hence the @Remove
method is not executed either.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list