Skip to content

Commit

Permalink
Synchronize more methods in SDRun
Browse files Browse the repository at this point in the history
  • Loading branch information
keszybz committed Aug 2, 2016
1 parent acc0593 commit 082b285
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/main/java/neurord/model/InitialConditions.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public synchronized HashMap<String, ConcentrationSet> getConcentrationSets() {
return this.concSetHM;
}

private ConcentrationSet getDefaultConcentrations() {
private synchronized ConcentrationSet getDefaultConcentrations() {
if (this.defaultConcs == null) {
if (this.concentrationSets != null)
for (ConcentrationSet set: this.concentrationSets)
Expand Down
16 changes: 9 additions & 7 deletions src/main/java/neurord/model/SDRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public boolean writeDependencies() {
}

transient private boolean _reactionSchemeResolved = false;
public ReactionScheme getReactionScheme() {
public synchronized ReactionScheme getReactionScheme() {
if (!this._reactionSchemeResolved) {
if (this.reactionScheme == null) {
log.error("<ReactionScheme> element is required");
Expand All @@ -223,14 +223,14 @@ public ReactionScheme getReactionScheme() {
}

transient private ReactionTable reactionTable;
public ReactionTable getReactionTable() {
public synchronized ReactionTable getReactionTable() {
if (this.reactionTable == null)
this.reactionTable = this.getReactionScheme().makeReactionTable();
return this.reactionTable;
}

transient private StimulationTable stimulationTable;
public StimulationTable getStimulationTable() {
public synchronized StimulationTable getStimulationTable() {
if (this.stimulationTable == null) {
List<InjectionStim> stimulations = null;
if (this.stimulationSet != null)
Expand Down Expand Up @@ -272,14 +272,16 @@ public Discretization getDiscretization() {
}

private transient InitialConditions _empty_initalConditions;
public synchronized InitialConditions getInitialConditions() {
public InitialConditions getInitialConditions() {
if (this.initialConditions != null)
return this.initialConditions;
else {

synchronized (this) {
if (this._empty_initalConditions == null)
this._empty_initalConditions = new InitialConditions();
return this._empty_initalConditions;
}
};

return this._empty_initalConditions;
}

public double getStartTime() {
Expand Down

0 comments on commit 082b285

Please sign in to comment.