openvidu-server: close sessions before closing KurentoClients on PreDestroy

pull/630/head
pabloFuente 2021-05-20 17:59:30 +02:00
parent 0117e7ece4
commit e2b6963a6b
2 changed files with 10 additions and 3 deletions

View File

@ -31,6 +31,8 @@ import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.annotation.PreDestroy;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.kurento.client.GenericMediaElement; import org.kurento.client.GenericMediaElement;
import org.kurento.client.IceCandidate; import org.kurento.client.IceCandidate;
@ -1444,4 +1446,11 @@ public class KurentoSessionManager extends SessionManager {
return lessLoadedKms; return lessLoadedKms;
} }
@PreDestroy
@Override
public void close() {
super.close();
this.kmsManager.closeAllKurentoClients();
}
} }

View File

@ -31,7 +31,6 @@ import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.kurento.jsonrpc.client.JsonRpcWSConnectionListener; import org.kurento.jsonrpc.client.JsonRpcWSConnectionListener;
@ -343,8 +342,7 @@ public abstract class KmsManager {
@PostConstruct @PostConstruct
protected abstract void postConstructInitKurentoClients(); protected abstract void postConstructInitKurentoClients();
@PreDestroy public void closeAllKurentoClients() {
public void close() {
log.info("Closing all KurentoClients"); log.info("Closing all KurentoClients");
this.kmss.values().forEach(kms -> { this.kmss.values().forEach(kms -> {
if (kms.getKurentoClientReconnectTimer() != null) { if (kms.getKurentoClientReconnectTimer() != null) {