[Jboss-cvs] JBossAS SVN: r55871 - in branches/JBoss_4_0_3_SP1_JBAS-3512: . common/src/main/org/jboss/util server/src/main/org/jboss/ejb/plugins
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Aug 14 09:02:00 EDT 2006
Author: darran.lofthouse at jboss.com
Date: 2006-08-14 09:01:56 -0400 (Mon, 14 Aug 2006)
New Revision: 55871
Modified:
branches/JBoss_4_0_3_SP1_JBAS-3512/
branches/JBoss_4_0_3_SP1_JBAS-3512/common/src/main/org/jboss/util/LRUCachePolicy.java
branches/JBoss_4_0_3_SP1_JBAS-3512/server/src/main/org/jboss/ejb/plugins/AbstractInstanceCache.java
Log:
JBAS-3512 - Merged fix to allow the EJB cache to temporarily grow.
Property changes on: branches/JBoss_4_0_3_SP1_JBAS-3512
___________________________________________________________________
Name: svn:ignore
+ thirdparty
.metadata
Modified: branches/JBoss_4_0_3_SP1_JBAS-3512/common/src/main/org/jboss/util/LRUCachePolicy.java
===================================================================
--- branches/JBoss_4_0_3_SP1_JBAS-3512/common/src/main/org/jboss/util/LRUCachePolicy.java 2006-08-14 13:01:43 UTC (rev 55870)
+++ branches/JBoss_4_0_3_SP1_JBAS-3512/common/src/main/org/jboss/util/LRUCachePolicy.java 2006-08-14 13:01:56 UTC (rev 55871)
@@ -337,9 +337,14 @@
protected void demote()
{
if (m_capacity < 1) {throw new IllegalStateException("Can't work with capacity < 1");}
- if (m_count > m_maxCapacity) {throw new IllegalStateException("Cache list entries number (" + m_count + ") > than the maximum allowed (" + m_maxCapacity + ")");}
- if (m_count == m_maxCapacity)
+
+ if (!(m_capacity > m_maxCapacity) && m_count > m_maxCapacity)
{
+ throw new IllegalStateException("Cache list entries number (" + m_count + ") > than the maximum allowed (" + m_maxCapacity + ")");
+ }
+
+ if (m_count >= m_maxCapacity)
+ {
LRUCacheEntry entry = m_tail;
// the entry will be removed by ageOut
Modified: branches/JBoss_4_0_3_SP1_JBAS-3512/server/src/main/org/jboss/ejb/plugins/AbstractInstanceCache.java
===================================================================
--- branches/JBoss_4_0_3_SP1_JBAS-3512/server/src/main/org/jboss/ejb/plugins/AbstractInstanceCache.java 2006-08-14 13:01:43 UTC (rev 55870)
+++ branches/JBoss_4_0_3_SP1_JBAS-3512/server/src/main/org/jboss/ejb/plugins/AbstractInstanceCache.java 2006-08-14 13:01:56 UTC (rev 55871)
@@ -138,11 +138,11 @@
getCache().insert(key, ctx);
}
}
-
- protected void tryToPassivate(EnterpriseContext ctx)
+
+ protected boolean tryToPassivate(EnterpriseContext ctx)
{
Object id = ctx.getId();
- if (id == null) return;
+ if (id == null) return false;
BeanLock lock = getContainer().getLockManager().getLock(id);
boolean lockedBean = false;
try
@@ -161,8 +161,8 @@
lockedBean = lock2.attemptSync();
if( lockedBean == false )
{
- log.warn("Unable to passivate due to ctx lock, id="+id);
- return;
+ log.warn("Unable to passivate due to ctx lock: " + lock +" , id="+id);
+ return false;
}
}
else
@@ -183,6 +183,7 @@
catch (Exception ignored)
{
log.warn("failed to passivate, id="+id, ignored);
+ return false;
}
}
else
@@ -194,12 +195,18 @@
{
getCache().get(id);
}
+ return false;
}
+ return true;
}
finally
{
if( lockedBean )
+ {
lock.releaseSync();
+ }
+
+ // getLock is adding a ref count so we need to decrement it.
getContainer().getLockManager().removeLockRef(id);
}
}
@@ -215,10 +222,12 @@
Object id = getKey(ctx);
synchronized (getCacheLock())
{
+ if(tryToPassivate(ctx))
+ {
if (getCache().peek(id) != null)
getCache().remove(id);
+ }
}
- tryToPassivate(ctx);
}
/**
More information about the jboss-cvs-commits
mailing list