Skip to content

Commit

Permalink
Fix unsafe publication
Browse files Browse the repository at this point in the history
Since `ReportContext` is accessed from both the main request-handling
thread and thread-pool threads (e.g., during query and evaluation, which
are parallelized across patients), its fields must be published safely
in order to ensure proper visibility.
  • Loading branch information
smailliwcs committed Mar 21, 2024
1 parent 80117cc commit b041967
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions core/src/main/java/com/lantanagroup/link/model/ReportContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
@Getter
@Setter
public class ReportContext {
private HttpServletRequest request;
private LinkCredentials user;
private String masterIdentifierValue;
private List<PatientList> patientLists = new ArrayList<>();
private List<PatientOfInterestModel> patientsOfInterest = new ArrayList<>();
private List<MeasureContext> measureContexts = new ArrayList<>();
private QueryPlan queryPlan;
private IGenericClient client;
private List<String> debugPatients = new ArrayList<>();
private volatile HttpServletRequest request;
private volatile LinkCredentials user;
private volatile String masterIdentifierValue;
private volatile List<PatientList> patientLists = new ArrayList<>();
private volatile List<PatientOfInterestModel> patientsOfInterest = new ArrayList<>();
private volatile List<MeasureContext> measureContexts = new ArrayList<>();
private volatile QueryPlan queryPlan;
private volatile IGenericClient client;
private volatile List<String> debugPatients = new ArrayList<>();

public ReportContext() {
}
Expand All @@ -54,13 +54,13 @@ public List<PatientOfInterestModel> getPatientsOfInterest(QueryPhase queryPhase)
@Getter
@Setter
public static class MeasureContext {
private String bundleId;
private Bundle reportDefBundle;
private Measure measure;
private String reportId;
private List<PatientOfInterestModel> patientsOfInterest = new ArrayList<>();
private Map<String, MeasureReport> patientReportsByPatientId = new HashMap<>();
private MeasureReport measureReport;
private volatile String bundleId;
private volatile Bundle reportDefBundle;
private volatile Measure measure;
private volatile String reportId;
private volatile List<PatientOfInterestModel> patientsOfInterest = new ArrayList<>();
private volatile Map<String, MeasureReport> patientReportsByPatientId = new HashMap<>();
private volatile MeasureReport measureReport;

public List<PatientOfInterestModel> getPatientsOfInterest(QueryPhase queryPhase) {
switch (queryPhase) {
Expand Down

0 comments on commit b041967

Please sign in to comment.