Skip to content

Commit

Permalink
Synchronize methods in SurfaceDensitySet too
Browse files Browse the repository at this point in the history
With this running "neuorord -Dneurord.trials=3 -t 1000" in a loop finally
does not cause an error (in ~2000 repetitions).
  • Loading branch information
keszybz committed Aug 2, 2016
1 parent 082b285 commit 3f874ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/main/java/neurord/model/InitialConditions.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ public double[] getRegionSurfaceDensities(String rnm, String[] spl) {


public String[] getTotalPreserved() {
if (fitConstraints != null)
return fitConstraints.getTotalPreserved();
if (this.fitConstraints != null)
return this.fitConstraints.getTotalPreserved();
else
return new String[0];
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/neurord/model/SurfaceDensitySet.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public class SurfaceDensitySet implements Regional {

transient HashMap<String, PicoSD> sdHM;

public HashMap<String, PicoSD> getSurfaceDensityHM() {
if (sdHM == null) {
sdHM = new HashMap<>();
public synchronized HashMap<String, PicoSD> getSurfaceDensityHM() {
if (this.sdHM == null) {
this.sdHM = new HashMap<>();
if (sds != null)
for (PicoSD sd : sds)
for (PicoSD sd: sds)
sdHM.put(sd.specieID, sd);
}
return sdHM;
Expand Down

0 comments on commit 3f874ee

Please sign in to comment.