@@ -118,18 +118,19 @@ private Pair<Network, OpenReacResult> run(VoltageInitRunContext context, UUID re
118
118
Network network = voltageInitObserver .observe ("network.load" , () ->
119
119
getNetwork (context .getNetworkUuid (), context .getVariantId ()));
120
120
121
+ AtomicReference <Reporter > rootReporter = new AtomicReference <>(Reporter .NO_OP );
121
122
if (context .getReportUuid () != null ) {
122
123
String rootReporterId = context .getReporterId () == null ? VOLTAGE_INIT_TYPE_REPORT : context .getReporterId () + "@" + context .getReportType ();
123
- Reporter rootReporter = new ReporterModel (rootReporterId , rootReporterId );
124
- context .setRootReporter (rootReporter .createSubReporter (context .getReportType (), VOLTAGE_INIT_TYPE_REPORT , VOLTAGE_INIT_TYPE_REPORT , context .getReportUuid ().toString ()));
124
+ rootReporter . set ( new ReporterModel (rootReporterId , rootReporterId ) );
125
+ context .setRootReporter (rootReporter .get (). createSubReporter (context .getReportType (), VOLTAGE_INIT_TYPE_REPORT , VOLTAGE_INIT_TYPE_REPORT , context .getReportUuid ().toString ()));
125
126
// Delete any previous VoltageInit computation logs
126
127
voltageInitObserver .observe ("report.delete" , () ->
127
128
reportService .deleteReport (context .getReportUuid (), context .getReportType ()));
128
129
}
129
130
CompletableFuture <OpenReacResult > future = runVoltageInitAsync (context , network , resultUuid );
130
131
if (context .getReportUuid () != null ) {
131
132
voltageInitObserver .observe ("report.send" , () ->
132
- reportService .sendReport (context .getReportUuid (), context . getRootReporter ()));
133
+ reportService .sendReport (context .getReportUuid (), rootReporter . get ()));
133
134
}
134
135
135
136
return future == null ? Pair .of (network , null ) : Pair .of (network , voltageInitObserver .observeRun ("run" , future ::get ));
0 commit comments