Merged V2.2 to HEAD

8265: Added catch blocks for the permissions service access denied exception to various file/folder operations
   8286: Merged V2.1 to V2.2
      8256: Fix broken WCM workflow.
      8257: Partial fix for AWC-1850
      8283: Merged V2.1-A to V2.1
         8264: Fine-grained debug logging for exceptions causing transaction retries.
   8288: Should fix workflow problems. Hard to test since almost nothing works right now.
   8291: Added Peter's fixes to improve deployment start scripts
   8294: Update deploy script from Peter
   8298: Fix for WCM-1058:
   8300: Commented out admin dashlet (active_tasks)
   8359: Fix AR-1735: Customer-requested POI upgrade
   8367: Fix for AWC-1639
   8368: Fix for WCM-1102
   8389: Revert changes between r8072 and r8251 from Schema2XForms.java
   8401: Fix for WCM-1105
   8407: Minor typo fix


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8488 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-03-10 17:23:01 +00:00
parent c5edd151e9
commit 78c695fc0a
9 changed files with 160 additions and 81 deletions

View File

@@ -24,8 +24,11 @@
*/
package org.alfresco.repo.domain.hibernate;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.alfresco.repo.avm.hibernate.SessionCacheChecker;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
@@ -33,6 +36,8 @@ import org.alfresco.util.resource.MethodResourceManager;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Session;
import org.hibernate.engine.CollectionKey;
import org.hibernate.engine.EntityKey;
import org.hibernate.stat.SessionStatistics;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
@@ -133,7 +138,8 @@ public class SessionSizeResourceManager extends HibernateDaoSupport implements M
if ((entityCount + collectionCount) > threshold)
{
session.flush();
session.clear();
selectivelyClear(session, stats);
// session.clear();
if (logger.isDebugEnabled())
{
String msg = String.format(
@@ -144,4 +150,28 @@ public class SessionSizeResourceManager extends HibernateDaoSupport implements M
}
}
}
@SuppressWarnings("unchecked")
private void selectivelyClear(Session session, SessionStatistics stats)
{
if (logger.isDebugEnabled())
{
logger.error(stats);
}
Set<EntityKey> keys = new HashSet<EntityKey>((Set<EntityKey>)stats.getEntityKeys());
for (EntityKey key : keys)
{
// This should probably be configurable but frankly the nauseous extrusion of Gavin King's
// programmatic alimentary tract (hibernate) will go away before this could make a difference.
if (!key.getEntityName().startsWith("org.alfresco"))
{
continue;
}
Object val = session.get(key.getEntityName(), key.getIdentifier());
if (val != null)
{
session.evict(val);
}
}
}
}