diff options
author | Caspar De Groot | 2011-07-04 05:57:33 +0000 |
---|---|---|
committer | Caspar De Groot | 2011-07-04 05:57:33 +0000 |
commit | 1b8822cdb83e6d503a06ab44599d36ac1740151a (patch) | |
tree | effb2070f48a5d907146f539709267b8e9eed7bd /plugins/org.eclipse.emf.cdo.server | |
parent | a434dcc32b4f4ff86818a334dbe04b3878b8604f (diff) | |
download | cdo-1b8822cdb83e6d503a06ab44599d36ac1740151a.tar.gz cdo-1b8822cdb83e6d503a06ab44599d36ac1740151a.tar.xz cdo-1b8822cdb83e6d503a06ab44599d36ac1740151a.zip |
[Bug 350649] Offline test and example failures
https://bugs.eclipse.org/bugs/show_bug.cgi?id=350649
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server')
-rw-r--r-- | plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TimeStampAuthority.java | 19 |
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 68c692eaef..eebbbfbc73 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) |