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.Pattern;
import javax.annotation.PreDestroy;
import org.apache.commons.lang3.RandomStringUtils;
import org.kurento.client.GenericMediaElement;
import org.kurento.client.IceCandidate;
@ -1444,4 +1446,11 @@ public class KurentoSessionManager extends SessionManager {
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 javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.apache.commons.lang3.RandomStringUtils;
import org.kurento.jsonrpc.client.JsonRpcWSConnectionListener;
@ -343,8 +342,7 @@ public abstract class KmsManager {
@PostConstruct
protected abstract void postConstructInitKurentoClients();
@PreDestroy
public void close() {
public void closeAllKurentoClients() {
log.info("Closing all KurentoClients");
this.kmss.values().forEach(kms -> {
if (kms.getKurentoClientReconnectTimer() != null) {