mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: fix KurentoClient association to Kms instances
parent
85a3dda3a1
commit
7670711f46
|
@ -29,16 +29,16 @@ public class FixedOneKmsManager extends KmsManager {
|
|||
public List<Kms> initializeKurentoClients(List<String> kmsUris) throws Exception {
|
||||
final String kmsUri = kmsUris.get(0);
|
||||
KurentoClient kClient = null;
|
||||
Kms kms = new Kms(kmsUri, loadManager);
|
||||
this.addKms(kms);
|
||||
try {
|
||||
kClient = KurentoClient.create(kmsUri, this.generateKurentoConnectionListener(kmsUri));
|
||||
kClient = KurentoClient.create(kmsUri, this.generateKurentoConnectionListener(kms.getId()));
|
||||
} catch (KurentoException e) {
|
||||
log.error("KMS in {} is not reachable by OpenVidu Server", kmsUri);
|
||||
throw new Exception();
|
||||
}
|
||||
Kms kms = new Kms(kmsUri, kClient, loadManager);
|
||||
kms.setKurentoClientConnected(true);
|
||||
kms.setTimeOfKurentoClientConnection(System.currentTimeMillis());
|
||||
this.addKms(kms);
|
||||
|
||||
kms.setKurentoClient(kClient);
|
||||
|
||||
return Arrays.asList(kms);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class Kms {
|
|||
|
||||
private Map<String, KurentoSession> kurentoSessions = new ConcurrentHashMap<>();
|
||||
|
||||
public Kms(String uri, KurentoClient client, LoadManager loadManager) {
|
||||
public Kms(String uri, LoadManager loadManager) {
|
||||
this.uri = uri;
|
||||
this.id = "KMS-" + RandomStringUtils.randomAlphanumeric(6).toUpperCase();
|
||||
|
||||
|
@ -75,11 +75,13 @@ public class Kms {
|
|||
} catch (MalformedURLException e) {
|
||||
log.error("KMS uri {} is not a valid WebSocket endpoint", uri);
|
||||
}
|
||||
|
||||
this.client = client;
|
||||
this.loadManager = loadManager;
|
||||
}
|
||||
|
||||
public void setKurentoClient(KurentoClient client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -173,6 +175,8 @@ public class Kms {
|
|||
|
||||
JsonObject kurentoExtraInfo = new JsonObject();
|
||||
|
||||
try {
|
||||
|
||||
kurentoExtraInfo.addProperty("memory", this.client.getServerManager().getUsedMemory() / 1024);
|
||||
|
||||
ServerInfo info = this.client.getServerManager().getInfo();
|
||||
|
@ -193,6 +197,10 @@ public class Kms {
|
|||
kurentoExtraInfo.add("modules", modules);
|
||||
|
||||
json.add("kurentoInfo", kurentoExtraInfo);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.warn("KMS {} extra info was requested but there's no connection to it", this.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue