You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2018/03/09 17:29:06 UTC

[openmeetings] branch master updated: [OPENMEETINGS-1649] kurento server init is fail-safe

This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git


The following commit(s) were added to refs/heads/master by this push:
     new 748fe16  [OPENMEETINGS-1649] kurento server init is fail-safe
748fe16 is described below

commit 748fe16422637cb90121bbe8d8b4169fb8b07103
Author: Maxim Solodovnik <so...@gmail.com>
AuthorDate: Sat Mar 10 00:28:55 2018 +0700

    [OPENMEETINGS-1649] kurento server init is fail-safe
---
 .../openmeetings/core/remote/KurentoHandler.java   | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KurentoHandler.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KurentoHandler.java
index bf593a2..da9f222 100644
--- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KurentoHandler.java
+++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KurentoHandler.java
@@ -21,6 +21,9 @@ package org.apache.openmeetings.core.remote;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
 import org.apache.openmeetings.core.util.WebSocketHelper;
 import org.apache.openmeetings.db.entity.basic.Client;
 import org.apache.openmeetings.db.manager.IClientManager;
@@ -37,13 +40,30 @@ import com.github.openjson.JSONObject;
 public class KurentoHandler {
 	private final static Logger log = LoggerFactory.getLogger(KurentoHandler.class);
 	public final static String KURENTO_TYPE = "kurento";
-	private final KurentoClient client = KurentoClient.create();
+	private KurentoClient client;
 	private final Map<Long, KRoom> rooms = new ConcurrentHashMap<>();
 	final Map<String, KUser> usersByUid = new ConcurrentHashMap<>();
 
 	@Autowired
 	private IClientManager clientManager;
 
+	@PostConstruct
+	private void init() {
+		try {
+			// TODO check connection, reconnect, listeners etc.
+			client = KurentoClient.create();
+		} catch (Exception e) {
+			log.error("Fail to create Kurento client", e);
+		}
+	}
+
+	@PreDestroy
+	private void destroy() {
+		if (client != null) {
+			destroy();
+		}
+	}
+
 	public void onMessage(String uid, JSONObject msg) {
 		final Client c = clientManager.get(uid);
 

-- 
To stop receiving notification emails like this one, please contact
solomax@apache.org.