openvidu-server: fix deprecations and remove warnings

v2
pabloFuente 2025-11-11 18:46:16 +01:00
parent 4c4bf277e2
commit bf56fe02a7
6 changed files with 16 additions and 12 deletions

View File

@ -544,6 +544,7 @@ public class RecordingProperties {
Boolean ignoreFailedStreamsParam;
try {
@SuppressWarnings("unused")
String session = (String) params.get("session");
nameParam = (String) params.get("name");
hasAudioParam = (Boolean) params.get("hasAudio");

View File

@ -353,7 +353,7 @@ public class PublisherEndpoint extends MediaEndpoint {
public JsonElement execMethod(String method, JsonObject params) throws OpenViduException {
Props props = new JsonUtils().fromJsonObjectToProps(params);
return (JsonElement) ((GenericMediaElement) this.filter).invoke(method, props, JsonElement.class);
return (JsonElement) this.filter.invoke(method, props, JsonElement.class);
}
public synchronized void mute(TrackType muteType) {

View File

@ -20,7 +20,6 @@ package io.openvidu.server.kurento.kms;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

View File

@ -59,7 +59,7 @@ public class Recording {
try {
this.duration = json.get("duration").getAsDouble();
} catch (Exception e) {
this.duration = Long.valueOf((long) json.get("duration").getAsLong()).doubleValue();
this.duration = Long.valueOf(json.get("duration").getAsLong()).doubleValue();
}
if (json.get("url").isJsonNull()) {
this.url = null;

View File

@ -165,14 +165,16 @@ public class SingleStreamRecordingService extends RecordingService {
});
final CountDownLatch stoppedCountDown = new CountDownLatch(wrappers.size());
ForkJoinPool customThreadPool = new ForkJoinPool(4);
try {
try (ForkJoinPool customThreadPool = new ForkJoinPool(4)) {
customThreadPool.submit(() -> wrappers.parallelStream().forEach(wrapper -> {
this.stopRecorderEndpointOfPublisherEndpoint(recording.getId(), wrapper.getStreamId(), stoppedCountDown,
kmsDisconnectionTime);
}));
} finally {
customThreadPool.shutdown();
customThreadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
} catch (InterruptedException e) {
recording.setStatus(io.openvidu.java.client.Recording.Status.failed);
log.error("Exception while stopping recorder endpoints", e);
}
try {
@ -253,7 +255,8 @@ public class SingleStreamRecordingService extends RecordingService {
RecorderEndpoint recorder = new RecorderEndpoint.Builder(pipeline,
"file://" + openviduConfig.getOpenViduRecordingPath(kmsUri) + recordingId + "/" + fileName
+ fileExtension).withMediaProfile(profile).build();
+ fileExtension)
.withMediaProfile(profile).build();
recorder.addRecordingListener(new EventListener<RecordingEvent>() {
@Override

View File

@ -1,6 +1,7 @@
package io.openvidu.server.test.integration.config;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyList;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ -44,7 +45,7 @@ public class IntegrationTestConfiguration {
List<Kms> successfullyConnectedKmss = new ArrayList<>();
List<KmsProperties> kmsProperties = null;
try {
kmsProperties = invocation.getArgument(0);
kmsProperties = invocation.<List<KmsProperties>>getArgument(0);
} catch (Exception e) {
Assertions.fail("Error getting argument from stubbed method: " + e.getMessage());
}
@ -63,13 +64,13 @@ public class IntegrationTestConfiguration {
Thread.sleep((long) (Math.random() * 1000));
Continuation<MediaPipeline> continuation = null;
try {
continuation = i.getArgument(0);
continuation = i.<Continuation<MediaPipeline>>getArgument(0);
} catch (Exception e) {
System.err.println("Error getting argument from stubbed method: " + e.getMessage());
}
continuation.onSuccess(mock(MediaPipeline.class));
return null;
}).when(kClient).createMediaPipeline((Continuation<MediaPipeline>) any());
}).when(kClient).createMediaPipeline(Mockito.<Continuation<MediaPipeline>>any());
ServerManager serverManagerMock = mock(ServerManager.class);
ServerInfo serverInfoMock = new ServerInfo("6.16.0", new ArrayList<>(), ServerType.KMS,
@ -85,7 +86,7 @@ public class IntegrationTestConfiguration {
successfullyConnectedKmss.add(kms);
}
return successfullyConnectedKmss;
}).when(spy).initializeKurentoClients(any(List.class), any(Boolean.class));
}).when(spy).initializeKurentoClients(anyList(), anyBoolean());
return spy;
}