mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-21 03:30:12 +00:00
working on a solution for bug 2897: introduced NamedReentrantReadWriteLock for TrackedRegattaImpl.trackedRaces and notify listeners outside of locked area
This commit is contained in:
1 parent
5d1322746a
commit
00b4a76f1c
10 files changed
+227
-49
No files matched your search
+11
-3
@@ -489,9 +489,17 @@ public class DomainFactoryImpl implements DomainFactory {
|
||||
TrackedRegatta trackedRegatta = trackedRegattaRegistry.getTrackedRegatta(regatta);
|
||||
if (trackedRegatta != null) {
|
||||
// see above; only remove tracked regatta if it *became* empty because of the tracked race removal here
|
||||
int oldSizeOfTrackedRaces = Util.size(trackedRegatta.getTrackedRaces());
|
||||
trackedRegatta.removeTrackedRace(raceDefinition);
|
||||
if (oldSizeOfTrackedRaces > 0 && Util.size(trackedRegatta.getTrackedRaces()) == 0) {
|
||||
final int oldSizeOfTrackedRaces;
|
||||
final int newSizeOfTrackedRaces;
|
||||
trackedRegatta.lockTrackedRacesForWrite();
|
||||
try {
|
||||
oldSizeOfTrackedRaces = Util.size(trackedRegatta.getTrackedRaces());
|
||||
trackedRegatta.removeTrackedRace(raceDefinition);
|
||||
newSizeOfTrackedRaces = Util.size(trackedRegatta.getTrackedRaces());
|
||||
} finally {
|
||||
trackedRegatta.unlockTrackedRacesAfterWrite();
|
||||
}
|
||||
if (oldSizeOfTrackedRaces > 0 && newSizeOfTrackedRaces == 0) {
|
||||
trackedRegattaRegistry.removeTrackedRegatta(regatta);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user