diff options
author | Harald Musum <musum@verizonmedia.com> | 2020-07-06 15:49:05 +0200 |
---|---|---|
committer | Harald Musum <musum@verizonmedia.com> | 2020-07-06 15:49:05 +0200 |
commit | 9ab8e7cf441a132512a1bb4e4011e30b3ac0e008 (patch) | |
tree | c4486f4bc7a72c10b9615353cbad5a9111c2befa /configserver | |
parent | 0235f8445c751d27e15fbe7dbc310a5bc73f0136 (diff) |
Add back lock in deleteLocalSession
Diffstat (limited to 'configserver')
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java index 51644a3047d..1e861ff8d33 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java @@ -206,13 +206,15 @@ public class SessionRepository { public void deleteLocalSession(LocalSession session) { long sessionId = session.getSessionId(); - log.log(Level.FINE, "Deleting local session " + sessionId); - SessionStateWatcher watcher = sessionStateWatchers.remove(sessionId); - if (watcher != null) watcher.close(); - localSessionCache.removeSession(sessionId); - NestedTransaction transaction = new NestedTransaction(); - deleteLocalSession(session, transaction); - transaction.commit(); + try (Lock lock = lock(sessionId)) { + log.log(Level.FINE, "Deleting local session " + sessionId); + SessionStateWatcher watcher = sessionStateWatchers.remove(sessionId); + if (watcher != null) watcher.close(); + localSessionCache.removeSession(sessionId); + NestedTransaction transaction = new NestedTransaction(); + deleteLocalSession(session, transaction); + transaction.commit(); + } } /** Add transactions to delete this session to the given nested transaction */ |