mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Another checkpoint. Added version checking to ChildEntry.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3236 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
<property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
|
<property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
|
||||||
<!-- <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property> -->
|
<!-- <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property> -->
|
||||||
<property name="show_sql">false</property>
|
<property name="show_sql">false</property>
|
||||||
<property name="order_updates">true</property>
|
<property name="order_updates">false</property>
|
||||||
<property name="connection.isolation">2</property>
|
<property name="connection.isolation">2</property>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
@@ -195,6 +195,7 @@ class AVMTester implements Runnable
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
long threadID = Thread.currentThread().getId();
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
for (int i = 0; i < fOpCount; i++)
|
for (int i = 0; i < fOpCount; i++)
|
||||||
{
|
{
|
||||||
@@ -206,7 +207,7 @@ class AVMTester implements Runnable
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
System.out.print(fID + ":" + i + ":");
|
System.out.print(threadID + ":" + i + ":");
|
||||||
int which = fgRandom.nextInt(fOpTable.length);
|
int which = fgRandom.nextInt(fOpTable.length);
|
||||||
switch (fOpTable[which])
|
switch (fOpTable[which])
|
||||||
{
|
{
|
||||||
|
@@ -42,6 +42,11 @@ public class ChildEntryImpl implements ChildEntry, Serializable
|
|||||||
*/
|
*/
|
||||||
private AVMNode fChild;
|
private AVMNode fChild;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Optimistic lock version
|
||||||
|
*/
|
||||||
|
private long fVers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor for Hibernate.
|
* Default constructor for Hibernate.
|
||||||
*/
|
*/
|
||||||
@@ -145,4 +150,20 @@ public class ChildEntryImpl implements ChildEntry, Serializable
|
|||||||
{
|
{
|
||||||
return fName.hashCode() + fParent.hashCode();
|
return fName.hashCode() + fParent.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the vers
|
||||||
|
*/
|
||||||
|
protected long getVers()
|
||||||
|
{
|
||||||
|
return fVers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param vers the vers to set
|
||||||
|
*/
|
||||||
|
protected void setVers(long vers)
|
||||||
|
{
|
||||||
|
fVers = vers;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -148,7 +148,7 @@
|
|||||||
column="root_id" not-null="true">
|
column="root_id" not-null="true">
|
||||||
</many-to-one>
|
</many-to-one>
|
||||||
</class>
|
</class>
|
||||||
<class name="ChildEntryImpl" proxy="ChildEntry" table="child_entries">
|
<class name="ChildEntryImpl" proxy="ChildEntry" table="child_entries" optimistic-lock="version">
|
||||||
<cache usage="read-write"/>
|
<cache usage="read-write"/>
|
||||||
<composite-id>
|
<composite-id>
|
||||||
<key-property name="name" type="string" column="name">
|
<key-property name="name" type="string" column="name">
|
||||||
@@ -156,6 +156,7 @@
|
|||||||
<key-many-to-one name="parent" column="parent_id" class="DirectoryNodeImpl">
|
<key-many-to-one name="parent" column="parent_id" class="DirectoryNodeImpl">
|
||||||
</key-many-to-one>
|
</key-many-to-one>
|
||||||
</composite-id>
|
</composite-id>
|
||||||
|
<version name="vers" column="vers" type="long"/>
|
||||||
<many-to-one name="child" column="child_id" class="AVMNodeImpl"
|
<many-to-one name="child" column="child_id" class="AVMNodeImpl"
|
||||||
not-null="true">
|
not-null="true">
|
||||||
</many-to-one>
|
</many-to-one>
|
||||||
|
@@ -115,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;
|
||||||
|
Reference in New Issue
Block a user