Checkpoint that fixes some problems I introduced in my last

checkin.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3230 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-06-24 02:07:16 +00:00
parent b580c28494
commit 62b7425361
2 changed files with 16 additions and 13 deletions

View File

@@ -61,12 +61,14 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
super(repos.getSuperRepository().issueID(), repos); super(repos.getSuperRepository().issueID(), repos);
Session sess = repos.getSuperRepository().getSession(); Session sess = repos.getSuperRepository().getSession();
sess.save(this); sess.save(this);
sess.flush();
for (ChildEntry child : other.getChildren()) for (ChildEntry child : other.getChildren())
{ {
ChildEntry newChild = new ChildEntryImpl(child.getName(), ChildEntry newChild = new ChildEntryImpl(child.getName(),
this, this,
child.getChild()); child.getChild());
sess.save(newChild); sess.save(newChild);
sess.flush();
} }
} }
@@ -182,7 +184,6 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
{ {
Session sess = SuperRepository.GetInstance().getSession(); Session sess = SuperRepository.GetInstance().getSession();
// sess.lock(this, LockMode.UPGRADE); // sess.lock(this, LockMode.UPGRADE);
sess.flush();
ChildEntry entry = new ChildEntryImpl(name, this, node); ChildEntry entry = new ChildEntryImpl(name, this, node);
ChildEntry existing = (ChildEntry)sess.get(ChildEntryImpl.class, (Serializable)entry); ChildEntry existing = (ChildEntry)sess.get(ChildEntryImpl.class, (Serializable)entry);
if (existing != null) if (existing != null)

View File

@@ -21,6 +21,7 @@ import java.util.Random;
import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.alfresco.repo.avm.AVMException; import org.alfresco.repo.avm.AVMException;
import org.hibernate.FlushMode;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.SessionFactory; import org.hibernate.SessionFactory;
@@ -87,6 +88,7 @@ public class HibernateTxn
} }
*/ */
sess = fSessionFactory.openSession(); sess = fSessionFactory.openSession();
sess.setFlushMode(FlushMode.ALWAYS);
txn = sess.beginTransaction(); txn = sess.beginTransaction();
callback.perform(sess); callback.perform(sess);
txn.commit(); txn.commit();
@@ -113,22 +115,22 @@ public class HibernateTxn
if (t instanceof StaleStateException) if (t instanceof StaleStateException)
{ {
System.err.println("Lost Race"); System.err.println("Lost Race");
StackTraceElement [] stack = t.getStackTrace(); // StackTraceElement [] stack = t.getStackTrace();
long threadID = Thread.currentThread().getId(); // long threadID = Thread.currentThread().getId();
for (StackTraceElement frame : stack) // for (StackTraceElement frame : stack)
{ // {
System.err.println(threadID + " " + frame); // System.err.println(threadID + " " + frame);
} // }
} }
else else
{ {
System.err.println("Deadlock"); System.err.println("Deadlock");
StackTraceElement [] stack = t.getStackTrace(); // StackTraceElement [] stack = t.getStackTrace();
long threadID = Thread.currentThread().getId(); // long threadID = Thread.currentThread().getId();
for (StackTraceElement frame : stack) // for (StackTraceElement frame : stack)
{ // {
System.err.println(threadID + " " + frame); // System.err.println(threadID + " " + frame);
} // }
try try
{ {
long interval; long interval;