[jboss-cvs] JBossAS SVN: r58643 - in branches/JBoss_4_0_3_SP1_CP: . 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 Nov 20 12:31:26 EST 2006
Author: vivekl at redhat.com
Date: 2006-11-20 12:31:23 -0500 (Mon, 20 Nov 2006)
New Revision: 58643
Modified:
branches/JBoss_4_0_3_SP1_CP/
branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/LRUCachePolicy.java
branches/JBoss_4_0_3_SP1_CP/server/src/main/org/jboss/ejb/plugins/AbstractInstanceCache.java
branches/JBoss_4_0_3_SP1_CP/server/src/main/org/jboss/ejb/plugins/EntitySynchronizationInterceptor.java
Log:
ASPATCH-119: JBAS-3512: JBAS-2668 - Automatically allow the EJB cache to temporarily grow.
Property changes on: branches/JBoss_4_0_3_SP1_CP
___________________________________________________________________
Name: svn:ignore
+ thirdparty
.metadata
Modified: branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/LRUCachePolicy.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/LRUCachePolicy.java 2006-11-20 17:12:24 UTC (rev 58642)
+++ branches/JBoss_4_0_3_SP1_CP/common/src/main/org/jboss/util/LRUCachePolicy.java 2006-11-20 17:31:23 UTC (rev 58643)
@@ -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_CP/server/src/main/org/jboss/ejb/plugins/AbstractInstanceCache.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/server/src/main/org/jboss/ejb/plugins/AbstractInstanceCache.java 2006-11-20 17:12:24 UTC (rev 58642)
+++ branches/JBoss_4_0_3_SP1_CP/server/src/main/org/jboss/ejb/plugins/AbstractInstanceCache.java 2006-11-20 17:31:23 UTC (rev 58643)
@@ -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);
}
/**
Modified: branches/JBoss_4_0_3_SP1_CP/server/src/main/org/jboss/ejb/plugins/EntitySynchronizationInterceptor.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/server/src/main/org/jboss/ejb/plugins/EntitySynchronizationInterceptor.java 2006-11-20 17:12:24 UTC (rev 58642)
+++ branches/JBoss_4_0_3_SP1_CP/server/src/main/org/jboss/ejb/plugins/EntitySynchronizationInterceptor.java 2006-11-20 17:31:23 UTC (rev 58643)
@@ -361,7 +361,7 @@
// don't want to return an instance to the pool that is
// being used
if(ctx.getId() != null)
- container.getInstanceCache().release(ctx);
+ container.getInstanceCache().remove(ctx.getId());
}
catch(Exception e)
{
More information about the jboss-cvs-commits
mailing list