if(!event.isPre()) return;
Fqn fqn = event.getFqn();
if(fqn.size() != FQN_SIZE) return;
if(!fqn.isChildOrEquals(cacheNode)) return;
StatefulBeanContext bean = null;
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
Boolean active = localActivity.get();
try
{
localActivity.set(Boolean.TRUE);
bean = (StatefulBeanContext) event.getData().get("bean");
if (bean != null)
{
ClassLoader cl = classloader.get();
if (cl != null)
{
Thread.currentThread().setContextClassLoader(cl);
}
if (!bean.getCanPassivate())
{
// Abort the eviction
throw new ContextInUseException("Cannot passivate bean " + fqn +
" -- it or one if its children is currently in use");
}
if(log.isTraceEnabled())
{
log.trace("nodePassivated(): send prePassivate event to bean at fqn: " +fqn);
}
bean.passivateAfterReplication();
++passivatedCount;
}
}
catch (NoSuchEJBException e)
{
// TODO is this still necessary? Don't think we
// should have orphaned proxies any more
if (bean instanceof ProxiedStatefulBeanContext)
{
// This is probably an orphaned proxy; double check and remove it
try
{
bean.getContainedIn();
// If that didn't fail, it's not an orphan
throw e;
}
catch (NoSuchEJBException n)
{