getTrackedRaces() now also checks for write lock count

This commit is contained in:
Axel Uhl committed 2015-05-28 00:23:02 +02:00
1 parent 00b4a76f1c
commit 11fd9f907d
1 file changed
+1 -1
@@ -168,7 +168,7 @@ public class TrackedRegattaImpl implements TrackedRegatta {
@Override
public Iterable<? extends TrackedRace> getTrackedRaces() {
if (trackedRacesLock.getReadHoldCount() <= 0) {
if (trackedRacesLock.getReadHoldCount() <= 0 && trackedRacesLock.getWriteHoldCount() <= 0) {
throw new IllegalStateException("Callers of TrackedRegatta.getTrackedRaces() must hold the read lock; see TrackedRegatta.lockTrackedRacesForRead()");
}
return trackedRaces.values();