Merged V3.0 to HEAD

12349: Tweaked the Hibernate session helper to prevent initially-large sessions from drowning the flush code
  12452: MT - fix ETHREEOH-1056
  12453: MT - fix ETHREEOH-886
  12460: MT - fix ETHREEOH-1013


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12536 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2008-12-22 16:42:39 +00:00
parent 38ba58dede
commit c4e9d6f97b
8 changed files with 118 additions and 42 deletions

View File

@@ -44,7 +44,6 @@ import org.alfresco.repo.domain.DbAuthority;
import org.alfresco.repo.domain.DbPermission;
import org.alfresco.repo.domain.Node;
import org.alfresco.repo.domain.QNameDAO;
import org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl;
import org.alfresco.repo.security.permissions.ACEType;
import org.alfresco.repo.security.permissions.ACLCopyMode;
import org.alfresco.repo.security.permissions.ACLType;
@@ -80,7 +79,7 @@ import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
*/
public class AclDaoComponentImpl extends HibernateDaoSupport implements AclDaoComponent
{
private static Log logger = LogFactory.getLog(HibernateNodeDaoServiceImpl.class);
private static Log logger = LogFactory.getLog(AclDaoComponentImpl.class);
static String QUERY_GET_PERMISSION = "permission.GetPermission";

View File

@@ -31,12 +31,9 @@ import java.util.List;
import java.util.Set;
import org.alfresco.util.GUID;
import org.hibernate.CacheMode;
import org.hibernate.Session;
import org.hibernate.engine.EntityKey;
import com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException;
/**
* Support to (optionally) listen to hibernate events generated by a hibernate session. The tracking is bound to a
* transaction resource
@@ -71,18 +68,13 @@ public class HibernateSessionHelperResource implements HibernateSessionHelperRes
public void mark(Session session)
{
Thread thread = Thread.currentThread();
String guid = GUID.generate();
mark(session, guid);
}
@SuppressWarnings("unchecked")
public void mark(Session session, String label)
{
session.flush();
if (label == null)
{
throw new HibernateSessionHelperResourceException("Null key is not supported");
@@ -99,10 +91,26 @@ public class HibernateSessionHelperResource implements HibernateSessionHelperRes
}
HashSet<EntityKey> mark = new HashSet<EntityKey>((Set<EntityKey>) session.getStatistics().getEntityKeys());
// If the mark is too large, then the flush process will be excessive.
if (mark.size() > 1000)
{
// The session is to big. Use the mark to as a basis for cleaning out the session.
if (currentMark == null)
{
// The session is just too big
SessionSizeResourceManager.clear(session);
}
else
{
reset(session);
}
// Get the mark list again
mark = new HashSet<EntityKey>((Set<EntityKey>) session.getStatistics().getEntityKeys());
}
marks.put(label, mark);
currentMark = label;
//System.out.println("Mark "+marks.size()+" "+currentMark);
}
public void removeMark(Session session)
@@ -205,11 +213,6 @@ public class HibernateSessionHelperResource implements HibernateSessionHelperRes
{
if (!check.contains(key))
{
if (!key.getEntityName().startsWith("org.alfresco"))
{
System.out.println("Oops: " + key.getEntityName());
}
if(key.getEntityName().equals(QNameEntityImpl.class.getName()))
{
//System.out.println("Skipping: " + key.getEntityName());