mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-25 05:23:51 +00:00
slightly related to bug 3172, obtain course read lock while writing the TrackedLegImpl structures
This commit is contained in:
1 parent
ca18ef3fcb
commit
4b7026fab8
1 file changed
+12
+12
@@ -2,6 +2,7 @@ package com.sap.sailing.domain.tracking.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -17,6 +18,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Course;
|
||||
import com.sap.sailing.domain.base.Leg;
|
||||
import com.sap.sailing.domain.base.SpeedWithBearingWithConfidence;
|
||||
import com.sap.sailing.domain.base.SpeedWithConfidence;
|
||||
@@ -77,6 +79,16 @@ public class TrackedLegImpl implements TrackedLeg {
|
||||
competitorTracksOrderedByRank = new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
private void writeObject(ObjectOutputStream oos) throws IOException {
|
||||
final Course course = trackedRace.getRace().getCourse();
|
||||
course.lockForRead();
|
||||
try {
|
||||
oos.defaultWriteObject();
|
||||
} finally {
|
||||
course.unlockAfterRead();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Leg getLeg() {
|
||||
return leg;
|
||||
|
||||
Reference in new issue
Block a user