|
11 | 11 | import com.powsybl.commons.PowsyblException;
|
12 | 12 | import com.powsybl.commons.reporter.Reporter;
|
13 | 13 | import com.powsybl.commons.reporter.ReporterModel;
|
14 |
| -import com.powsybl.computation.local.LocalComputationManager; |
15 | 14 | import com.powsybl.iidm.network.*;
|
16 | 15 | import com.powsybl.iidm.network.extensions.IdentifiableShortCircuit;
|
17 | 16 | import com.powsybl.network.store.client.NetworkStoreService;
|
@@ -52,27 +51,29 @@ public class ShortCircuitWorkerService {
|
52 | 51 | private static final String SHORTCIRCUIT_ALL_BUSES_DEFAULT_TYPE_REPORT = "AllBusesShortCircuitAnalysis";
|
53 | 52 | private static final String SHORTCIRCUIT_ONE_BUS_DEFAULT_TYPE_REPORT = "OneBusShortCircuitAnalysis";
|
54 | 53 |
|
55 |
| - private NetworkStoreService networkStoreService; |
56 |
| - private ReportService reportService; |
57 |
| - private ShortCircuitAnalysisResultRepository resultRepository; |
58 |
| - private NotificationService notificationService; |
59 |
| - private ObjectMapper objectMapper; |
| 54 | + private final NetworkStoreService networkStoreService; |
| 55 | + private final ReportService reportService; |
| 56 | + private final ShortCircuitAnalysisResultRepository resultRepository; |
| 57 | + private final NotificationService notificationService; |
| 58 | + private final ShortCircuitExecutionService shortCircuitExecutionService; |
| 59 | + private final ObjectMapper objectMapper; |
60 | 60 | private final Collection<AbstractReportMapper> reportMappers;
|
61 | 61 |
|
62 |
| - private Map<UUID, CompletableFuture<ShortCircuitAnalysisResult>> futures = new ConcurrentHashMap<>(); |
| 62 | + private final Map<UUID, CompletableFuture<ShortCircuitAnalysisResult>> futures = new ConcurrentHashMap<>(); |
63 | 63 |
|
64 |
| - private Map<UUID, ShortCircuitCancelContext> cancelComputationRequests = new ConcurrentHashMap<>(); |
| 64 | + private final Map<UUID, ShortCircuitCancelContext> cancelComputationRequests = new ConcurrentHashMap<>(); |
65 | 65 |
|
66 |
| - private Set<UUID> runRequests = Sets.newConcurrentHashSet(); |
| 66 | + private final Set<UUID> runRequests = Sets.newConcurrentHashSet(); |
67 | 67 |
|
68 | 68 | private final Lock lockRunAndCancelShortCircuitAnalysis = new ReentrantLock();
|
69 | 69 |
|
70 | 70 | @Autowired
|
71 |
| - public ShortCircuitWorkerService(NetworkStoreService networkStoreService, ReportService reportService, |
| 71 | + public ShortCircuitWorkerService(NetworkStoreService networkStoreService, ReportService reportService, ShortCircuitExecutionService shortCircuitExecutionService, |
72 | 72 | NotificationService notificationService, ShortCircuitAnalysisResultRepository resultRepository,
|
73 | 73 | ObjectMapper objectMapper, Collection<AbstractReportMapper> reportMappers) {
|
74 | 74 | this.networkStoreService = Objects.requireNonNull(networkStoreService);
|
75 | 75 | this.reportService = Objects.requireNonNull(reportService);
|
| 76 | + this.shortCircuitExecutionService = Objects.requireNonNull(shortCircuitExecutionService); |
76 | 77 | this.notificationService = Objects.requireNonNull(notificationService);
|
77 | 78 | this.resultRepository = Objects.requireNonNull(resultRepository);
|
78 | 79 | this.objectMapper = Objects.requireNonNull(objectMapper);
|
@@ -183,7 +184,7 @@ private CompletableFuture<ShortCircuitAnalysisResult> runShortCircuitAnalysisAsy
|
183 | 184 | network,
|
184 | 185 | faults,
|
185 | 186 | context.getParameters(),
|
186 |
| - LocalComputationManager.getDefault(), |
| 187 | + shortCircuitExecutionService.getComputationManager(), |
187 | 188 | List.of(),
|
188 | 189 | reporter);
|
189 | 190 | if (resultUuid != null) {
|
|
0 commit comments