You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ol...@apache.org on 2003/06/09 23:38:31 UTC
cvs commit: db-ojb/src/java/org/apache/ojb/otm/lock/wait TimeoutStrategy.java
olegnitz 2003/06/09 14:38:30
Modified: src/java/org/apache/ojb/otm/core ConcreteEditingContext.java
src/java/org/apache/ojb/otm/lock/wait TimeoutStrategy.java
Log:
Minor fixes
Revision Changes Path
1.9 +2 -1 db-ojb/src/java/org/apache/ojb/otm/core/ConcreteEditingContext.java
Index: ConcreteEditingContext.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/core/ConcreteEditingContext.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ConcreteEditingContext.java 9 Jun 2003 18:55:26 -0000 1.8
+++ ConcreteEditingContext.java 9 Jun 2003 21:38:30 -0000 1.9
@@ -318,7 +318,7 @@
{
public int compare(Object o1, Object o2)
{
- return o1.hashCode() - o1.hashCode();
+ return o1.hashCode() - o2.hashCode();
}
public boolean equals(Object obj)
@@ -326,6 +326,7 @@
return false;
}
});
+
try {
// mark dirty objects and lock them for write
for (int i = 0; i < lockOrder.length; i++)
1.3 +11 -5 db-ojb/src/java/org/apache/ojb/otm/lock/wait/TimeoutStrategy.java
Index: TimeoutStrategy.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/lock/wait/TimeoutStrategy.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TimeoutStrategy.java 18 May 2003 18:14:24 -0000 1.2
+++ TimeoutStrategy.java 9 Jun 2003 21:38:30 -0000 1.3
@@ -91,10 +91,12 @@
{
long now = System.currentTimeMillis();
long deadline = System.currentTimeMillis() + _timeout;
+ Transaction writer = null;
do
{
- if (lock.getWriter() == null)
+ writer = lock.getWriter();
+ if (writer == null)
{
return;
}
@@ -109,10 +111,14 @@
}
}
while (now < deadline);
-
- throw new ConcurrentModificationException(
- "Object [id: " + lock.getTargetIdentity()
- + "] locked by Transaction " + lock.getWriter());
+
+ writer = lock.getWriter();
+ if (writer != null)
+ {
+ throw new ConcurrentModificationException(
+ "Object [id: " + lock.getTargetIdentity()
+ + "] locked by Transaction " + writer);
+ }
}
finally
{