openvidu-server: KmsManager.MAX_SECONDS_LOCK_WAIT

pull/494/head
pabloFuente 2020-05-17 18:12:32 +02:00
parent c9a5709852
commit 72c62772f2
2 changed files with 3 additions and 4 deletions

View File

@ -82,8 +82,6 @@ public class KurentoSessionManager extends SessionManager {
@Autowired @Autowired
private KurentoParticipantEndpointConfig kurentoEndpointConfig; private KurentoParticipantEndpointConfig kurentoEndpointConfig;
private final int MS_MAX_LOCK_WAIT = 15;
@Override @Override
/* Protected by Session.closingLock.readLock */ /* Protected by Session.closingLock.readLock */
public void joinRoom(Participant participant, String sessionId, Integer transactionId) { public void joinRoom(Participant participant, String sessionId, Integer transactionId) {
@ -105,7 +103,7 @@ public class KurentoSessionManager extends SessionManager {
} }
try { try {
if (KmsManager.selectAndRemoveKmsLock.tryLock(MS_MAX_LOCK_WAIT, TimeUnit.SECONDS)) { if (KmsManager.selectAndRemoveKmsLock.tryLock(KmsManager.MAX_SECONDS_LOCK_WAIT, TimeUnit.SECONDS)) {
try { try {
kSession = (KurentoSession) sessions.get(sessionId); kSession = (KurentoSession) sessions.get(sessionId);
@ -131,7 +129,7 @@ public class KurentoSessionManager extends SessionManager {
} }
} else { } else {
String error = "Timeout of " + MS_MAX_LOCK_WAIT + " seconds waiting to acquire lock"; String error = "Timeout of " + KmsManager.MAX_SECONDS_LOCK_WAIT + " seconds waiting to acquire lock";
log.error(error); log.error(error);
sessionEventsHandler.onParticipantJoined(participant, sessionId, null, transactionId, sessionEventsHandler.onParticipantJoined(participant, sessionId, null, transactionId,
new OpenViduException(Code.ROOM_CANNOT_BE_CREATED_ERROR_CODE, error)); new OpenViduException(Code.ROOM_CANNOT_BE_CREATED_ERROR_CODE, error));

View File

@ -49,6 +49,7 @@ public abstract class KmsManager {
protected static final Logger log = LoggerFactory.getLogger(KmsManager.class); protected static final Logger log = LoggerFactory.getLogger(KmsManager.class);
public static final Lock selectAndRemoveKmsLock = new ReentrantLock(true); public static final Lock selectAndRemoveKmsLock = new ReentrantLock(true);
public static final int MAX_SECONDS_LOCK_WAIT = 15;
private Map<String, Lock> kmsReconnectionLocks = new ConcurrentHashMap<>(); private Map<String, Lock> kmsReconnectionLocks = new ConcurrentHashMap<>();