Cleanup configuration as component change listener.
This commit is contained in:
parent
9ce96bdc05
commit
d48a2cb400
@ -303,11 +303,13 @@ public class Simulation implements ChangeSource, Cloneable {
|
||||
|
||||
// Set simulated info after simulation, will not be set in case of exception
|
||||
simulatedConditions = options.clone();
|
||||
simulatedMotors = getConfiguration().getMotorConfigurationDescription();
|
||||
final Configuration configuration = getConfiguration();
|
||||
simulatedMotors = configuration.getMotorConfigurationDescription();
|
||||
simulatedRocketID = rocket.getFunctionalModID();
|
||||
|
||||
status = Status.UPTODATE;
|
||||
fireChangeEvent();
|
||||
configuration.release();
|
||||
} finally {
|
||||
mutex.unlock("simulate");
|
||||
}
|
||||
|
@ -94,8 +94,10 @@ public class RocksimSaver extends RocketSaver {
|
||||
|
||||
MassCalculator massCalc = new BasicMassCalculator();
|
||||
|
||||
final double cg = massCalc.getCG(new Configuration(rocket), MassCalculator.MassCalcType.NO_MOTORS).x *
|
||||
final Configuration configuration = new Configuration(rocket);
|
||||
final double cg = massCalc.getCG(configuration, MassCalculator.MassCalcType.NO_MOTORS).x *
|
||||
RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH;
|
||||
configuration.release();
|
||||
int stageCount = rocket.getStageCount();
|
||||
if (stageCount == 3) {
|
||||
result.setStage321CG(cg);
|
||||
|
@ -419,6 +419,7 @@ public class DesignReport {
|
||||
c.setBorder(PdfPCell.LEFT);
|
||||
c.setBorderWidthTop(0f);
|
||||
parent.addCell(c);
|
||||
config.release();
|
||||
}
|
||||
|
||||
|
||||
|
@ -169,6 +169,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
||||
log.info("Warnings at the end of simulation: " + flightData.getWarningSet());
|
||||
}
|
||||
|
||||
configuration.release();
|
||||
// TODO: HIGH: Simulate branches
|
||||
return flightData;
|
||||
}
|
||||
@ -534,7 +535,6 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
||||
* This method jumps the simulation time forward in case no motors have been ignited.
|
||||
* The flight event is removed from the event queue.
|
||||
*
|
||||
* @param status the simulation status
|
||||
* @return the flight event to handle, or null
|
||||
*/
|
||||
private FlightEvent nextEvent() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user