@@ -118,18 +118,19 @@ private Pair<Network, OpenReacResult> run(VoltageInitRunContext context, UUID re
118118 Network network = voltageInitObserver .observe ("network.load" , () ->
119119 getNetwork (context .getNetworkUuid (), context .getVariantId ()));
120120
121+ AtomicReference <Reporter > rootReporter = new AtomicReference <>(Reporter .NO_OP );
121122 if (context .getReportUuid () != null ) {
122123 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 ()));
125126 // Delete any previous VoltageInit computation logs
126127 voltageInitObserver .observe ("report.delete" , () ->
127128 reportService .deleteReport (context .getReportUuid (), context .getReportType ()));
128129 }
129130 CompletableFuture <OpenReacResult > future = runVoltageInitAsync (context , network , resultUuid );
130131 if (context .getReportUuid () != null ) {
131132 voltageInitObserver .observe ("report.send" , () ->
132- reportService .sendReport (context .getReportUuid (), context . getRootReporter ()));
133+ reportService .sendReport (context .getReportUuid (), rootReporter . get ()));
133134 }
134135
135136 return future == null ? Pair .of (network , null ) : Pair .of (network , voltageInitObserver .observeRun ("run" , future ::get ));
0 commit comments