Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TimeStampAuthority.java')
-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 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)

Back to the top