if(entry == null)
{
entry = pm.activateSession(key);
if (entry == null)
{
throw new NoSuchEJBException("Could not find stateful bean: " + key);
}
--passivatedCount;
// We cache the entry even if we will throw an exception below
// as we may still need it for its children and XPC references
if (log.isTraceEnabled())
{
log.trace("Caching activated context " + entry.getId() + " of type " + entry.getClass());
}
synchronized (cacheMap)
{
cacheMap.put(key, entry);
}
}
}
}
// Now we know entry isn't null
if (markInUse)
{
if (entry.isRemoved())
{
throw new NoSuchEJBException("Could not find stateful bean: " + key +
" (bean was marked as removed");
}
entry.setInUse(true);
entry.lastUsed = System.currentTimeMillis();