summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaspar De Groot2011-07-06 07:55:16 (EDT)
committerCaspar De Groot2011-07-06 07:55:16 (EDT)
commit316cdfa98bb7b23785a5a11d3cd0900587084531 (patch)
tree7da5ed2a1702355c3c3f0bf1f36eb084e7a9ec9c
parente9e9c7772de6dee2570844e6c6dd0ca5ab40d688 (diff)
downloadcdo-316cdfa98bb7b23785a5a11d3cd0900587084531.zip
cdo-316cdfa98bb7b23785a5a11d3cd0900587084531.tar.gz
cdo-316cdfa98bb7b23785a5a11d3cd0900587084531.tar.bz2
[351046] Offline test and example failures
https://bugs.eclipse.org/bugs/show_bug.cgi?id=351046
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TimeStampAuthority.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TimeStampAuthority.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TimeStampAuthority.java
index 68c692e..eebbbfb 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TimeStampAuthority.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TimeStampAuthority.java
@@ -100,11 +100,10 @@ class TimeStampAuthority
now = timeStampOverride;
}
- long previousIssuedTimeStamp = lastIssuedTimeStamp;
lastIssuedTimeStamp = now;
runningTransactions.add(lastIssuedTimeStamp);
- return new long[] { lastIssuedTimeStamp, previousIssuedTimeStamp };
+ return new long[] { lastIssuedTimeStamp, getLastFinishedTimeStamp() };
}
finally
{
@@ -125,10 +124,20 @@ class TimeStampAuthority
// of the runningTransactions. Since both sets are sorted, we only need to compare the heads.
long oldestRunning = runningTransactions.isEmpty() ? Long.MAX_VALUE : runningTransactions.get(0);
long oldestFinished;
- while (!finishedTransactions.isEmpty() && (oldestFinished = finishedTransactions.first()) < oldestRunning)
+ synchronized (lastCommitTimeStampLock)
{
- finishedTransactions.remove(oldestFinished);
- lastFinishedTimeStamp = oldestFinished;
+ long oldValue = lastFinishedTimeStamp;
+ while (!finishedTransactions.isEmpty() && (oldestFinished = finishedTransactions.first()) < oldestRunning)
+ {
+ finishedTransactions.remove(oldestFinished);
+ lastFinishedTimeStamp = oldestFinished;
+ }
+
+ // If we actually changed the lastFinishedTimeStamp, we need to notify waiting threads
+ if (lastFinishedTimeStamp != oldValue)
+ {
+ lastCommitTimeStampLock.notifyAll();
+ }
}
if (strictOrdering)