Forgot a lock

This commit is contained in:
Nassim Jahnke 2022-08-11 19:08:33 +02:00
parent ed196bdf99
commit 47b15e5fef
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B

View File

@ -33,14 +33,15 @@ public abstract class AbstractProtocolDetectorService implements ProtocolDetecto
public int serverProtocolVersion(final String serverName) {
// Step 1. Check detected
lock.readLock().lock();
final int detectedProtocol;
try {
final int detectedProtocol = detectedProtocolIds.getInt(serverName);
if (detectedProtocol != -1) {
return detectedProtocol;
}
detectedProtocol = detectedProtocolIds.getInt(serverName);
} finally {
lock.readLock().unlock();
}
if (detectedProtocol != -1) {
return detectedProtocol;
}
// Step 2. Check config (CME moment?)
final Map<String, Integer> servers = configuredServers();
@ -81,6 +82,7 @@ public abstract class AbstractProtocolDetectorService implements ProtocolDetecto
@Override
public Object2IntMap<String> detectedProtocolVersions() {
lock.readLock().lock();
try {
return new Object2IntOpenHashMap<>(detectedProtocolIds);
} finally {