openvidu-server: fix ForkJoinPool not being autoclosable now

v2
pabloFuente 2025-11-20 11:45:21 +01:00
parent 76ecaf44ff
commit 51cf1bcbc6
1 changed files with 5 additions and 1 deletions

View File

@ -165,7 +165,8 @@ public class SingleStreamRecordingService extends RecordingService {
});
final CountDownLatch stoppedCountDown = new CountDownLatch(wrappers.size());
try (ForkJoinPool customThreadPool = new ForkJoinPool(4)) {
ForkJoinPool customThreadPool = new ForkJoinPool(4);
try {
customThreadPool.submit(() -> wrappers.parallelStream().forEach(wrapper -> {
this.stopRecorderEndpointOfPublisherEndpoint(recording.getId(), wrapper.getStreamId(), stoppedCountDown,
kmsDisconnectionTime);
@ -173,8 +174,11 @@ public class SingleStreamRecordingService extends RecordingService {
customThreadPool.shutdown();
customThreadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
recording.setStatus(io.openvidu.java.client.Recording.Status.failed);
log.error("Exception while stopping recorder endpoints", e);
} finally {
customThreadPool.shutdownNow();
}
try {