ImportMasterDataOperation now initializes RaceLogInformation in readObject

fixes bug2023
This commit is contained in:
Frederik Petersen committed 2014-07-11 13:34:58 +02:00
1 parent 75bacf0a79
commit 60f3c4811d
1 file changed
+19
@@ -1,6 +1,7 @@
package com.sap.sailing.server.operationaltransformation;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
@@ -15,6 +16,7 @@ import com.sap.sailing.domain.base.Fleet;
import com.sap.sailing.domain.base.RaceColumn;
import com.sap.sailing.domain.base.RaceDefinition;
import com.sap.sailing.domain.base.Regatta;
import com.sap.sailing.domain.base.impl.RegattaImpl;
import com.sap.sailing.domain.common.DataImportProgress;
import com.sap.sailing.domain.common.RaceIdentifier;
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
@@ -99,6 +101,9 @@ public class ImportMasterDataOperation extends
createWindTracks(toState);
toState.getDataImportLock().getProgress(importOperationId).setResult(creationCount);
return creationCount;
} catch (Exception e) {
logger.severe("Error during execution of ImportMasterDataOperation");
throw new RuntimeException("Error during execution of ImportMasterDataOperation", e);
} finally {
toState.getDataImportLock().unlock();
}
@@ -406,4 +411,18 @@ public class ImportMasterDataOperation extends
return null;
}
/**
* in order to restore all listeners we need to initialize the regatta after the whole object graph has been
* restored. This applies to all replicas that receive this operation "over the wire".
*
* Fixes bug2023
*/
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
ois.defaultReadObject();
for (Regatta regatta : masterData.getAllRegattas()) {
RegattaImpl regattaImpl = (RegattaImpl) regatta;
regattaImpl.initializeSeriesAfterDeserialize();
}
}
}