openvidu-server: remove unused destroyWhenUnused

pull/331/head
pabloFuente 2019-10-04 10:56:35 +02:00
parent 021944801e
commit 5f1f360a5b
4 changed files with 5 additions and 24 deletions

View File

@ -58,15 +58,13 @@ public class KurentoSession extends Session {
private Object pipelineCreateLock = new Object(); private Object pipelineCreateLock = new Object();
private Object pipelineReleaseLock = new Object(); private Object pipelineReleaseLock = new Object();
private boolean destroyKurentoClient;
public final ConcurrentHashMap<String, String> publishedStreamIds = new ConcurrentHashMap<>(); public final ConcurrentHashMap<String, String> publishedStreamIds = new ConcurrentHashMap<>();
public KurentoSession(Session sessionNotActive, Kms kms, KurentoSessionEventsHandler kurentoSessionHandler, public KurentoSession(Session sessionNotActive, Kms kms, KurentoSessionEventsHandler kurentoSessionHandler,
KurentoParticipantEndpointConfig kurentoEndpointConfig, boolean destroyKurentoClient) { KurentoParticipantEndpointConfig kurentoEndpointConfig) {
super(sessionNotActive); super(sessionNotActive);
this.kms = kms; this.kms = kms;
this.destroyKurentoClient = destroyKurentoClient;
this.kurentoSessionHandler = kurentoSessionHandler; this.kurentoSessionHandler = kurentoSessionHandler;
this.kurentoEndpointConfig = kurentoEndpointConfig; this.kurentoEndpointConfig = kurentoEndpointConfig;
log.debug("New SESSION instance with id '{}'", sessionId); log.debug("New SESSION instance with id '{}'", sessionId);
@ -155,10 +153,6 @@ public class KurentoSession extends Session {
log.debug("Session {} closed", this.sessionId); log.debug("Session {} closed", this.sessionId);
if (destroyKurentoClient) {
kms.getKurentoClient().destroy();
}
// Also disassociate the KurentoSession from the Kms // Also disassociate the KurentoSession from the Kms
kms.removeKurentoSession(this.sessionId); kms.removeKurentoSession(this.sessionId);

View File

@ -496,8 +496,7 @@ public class KurentoSessionManager extends SessionManager {
throw new OpenViduException(Code.ROOM_CANNOT_BE_CREATED_ERROR_CODE, throw new OpenViduException(Code.ROOM_CANNOT_BE_CREATED_ERROR_CODE,
"Session '" + session.getSessionId() + "' already exists"); "Session '" + session.getSessionId() + "' already exists");
} }
session = new KurentoSession(sessionNotActive, kms, kurentoSessionEventsHandler, kurentoEndpointConfig, session = new KurentoSession(sessionNotActive, kms, kurentoSessionEventsHandler, kurentoEndpointConfig);
kmsManager.destroyWhenUnused());
KurentoSession oldSession = (KurentoSession) sessions.putIfAbsent(session.getSessionId(), session); KurentoSession oldSession = (KurentoSession) sessions.putIfAbsent(session.getSessionId(), session);
if (oldSession != null) { if (oldSession != null) {
@ -845,10 +844,6 @@ public class KurentoSessionManager extends SessionManager {
return ((KurentoSession) session).getParticipantPrivateIdFromStreamId(streamId); return ((KurentoSession) session).getParticipantPrivateIdFromStreamId(streamId);
} }
public KmsManager getKmsManager() {
return this.kmsManager;
}
private void applyFilterInPublisher(KurentoParticipant kParticipant, KurentoFilter filter) private void applyFilterInPublisher(KurentoParticipant kParticipant, KurentoFilter filter)
throws OpenViduException { throws OpenViduException {
GenericMediaElement.Builder builder = new GenericMediaElement.Builder(kParticipant.getPipeline(), GenericMediaElement.Builder builder = new GenericMediaElement.Builder(kParticipant.getPipeline(),

View File

@ -40,7 +40,7 @@ public class SubscriberEndpoint extends MediaEndpoint {
private AtomicBoolean connectedToPublisher = new AtomicBoolean(false); private AtomicBoolean connectedToPublisher = new AtomicBoolean(false);
private PublisherEndpoint publisher = null; private String publisherStreamId;
public SubscriberEndpoint(boolean web, KurentoParticipant owner, String endpointName, MediaPipeline pipeline, public SubscriberEndpoint(boolean web, KurentoParticipant owner, String endpointName, MediaPipeline pipeline,
OpenviduConfig openviduConfig) { OpenviduConfig openviduConfig) {
@ -54,7 +54,7 @@ public class SubscriberEndpoint extends MediaEndpoint {
gatherCandidates(); gatherCandidates();
publisher.connect(this.getEndpoint()); publisher.connect(this.getEndpoint());
setConnectedToPublisher(true); setConnectedToPublisher(true);
setPublisher(publisher); this.publisherStreamId = publisher.getStreamId();
return sdpAnswer; return sdpAnswer;
} }
@ -66,15 +66,11 @@ public class SubscriberEndpoint extends MediaEndpoint {
this.connectedToPublisher.set(connectedToPublisher); this.connectedToPublisher.set(connectedToPublisher);
} }
public void setPublisher(PublisherEndpoint publisher) {
this.publisher = publisher;
}
@Override @Override
public JsonObject toJson() { public JsonObject toJson() {
JsonObject json = super.toJson(); JsonObject json = super.toJson();
try { try {
json.addProperty("streamId", this.publisher.getStreamId()); json.addProperty("streamId", this.publisherStreamId);
} catch (NullPointerException ex) { } catch (NullPointerException ex) {
json.addProperty("streamId", "NOT_FOUND"); json.addProperty("streamId", "NOT_FOUND");
} }

View File

@ -132,10 +132,6 @@ public abstract class KmsManager {
return kmsLoads; return kmsLoads;
} }
public boolean destroyWhenUnused() {
return false;
}
protected KurentoConnectionListener generateKurentoConnectionListener(String kmsId) { protected KurentoConnectionListener generateKurentoConnectionListener(String kmsId) {
return new KurentoConnectionListener() { return new KurentoConnectionListener() {