From: kkolinko Date: Mon, 21 Dec 2009 13:31:46 +0000 (+0000) Subject: Second followup to r892341 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=c4dca8391f2cf2b0a6d3989bd5e21f503748e4c5;p=tomcat7.0 Second followup to r892341 Small improvements, based on sebb's and my comments. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@892817 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/session/PersistentManagerBase.java b/java/org/apache/catalina/session/PersistentManagerBase.java index 406561f8d..660affb46 100644 --- a/java/org/apache/catalina/session/PersistentManagerBase.java +++ b/java/org/apache/catalina/session/PersistentManagerBase.java @@ -213,7 +213,7 @@ public abstract class PersistentManagerBase /** * Sessions currently being swapped in and the associated locks */ - private Map sessionSwapInLocks = + private final Map sessionSwapInLocks = new HashMap(); @@ -794,15 +794,14 @@ public abstract class PersistentManagerBase /* * The purpose of this sync and these locks is to make sure that a * session is only loaded once. It doesn't matter if the lock is removed - * and then another thread enters this method and trues to load the same - * session. That thread will re-creates a swapIn lock for that session, + * and then another thread enters this method and tries to load the same + * session. That thread will re-create a swapIn lock for that session, * quickly find that the session is already in sessions, use it and * carry on. */ synchronized (this) { - if (sessionSwapInLocks.containsKey(id)) { - swapInLock = sessionSwapInLocks.get(id); - } else { + swapInLock = sessionSwapInLocks.get(id); + if (swapInLock == null) { swapInLock = new Object(); sessionSwapInLocks.put(id, swapInLock); }