You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2024/09/03 09:48:26 UTC
(tomcat) branch 9.0.x updated: Sync in needed to iterate safely over Collections.synchronizedList
This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new ee49341f39 Sync in needed to iterate safely over Collections.synchronizedList
ee49341f39 is described below
commit ee49341f39ebd85d3babad46d0d0239d38bc4a46
Author: remm <re...@apache.org>
AuthorDate: Tue Sep 3 11:35:37 2024 +0200
Sync in needed to iterate safely over Collections.synchronizedList
As a result it is likely simpler to use CopyOnWriteArrayList instead.
Also make types more explicit (see if it makes Coverity happier).
---
java/org/apache/catalina/servlets/WebdavServlet.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java b/java/org/apache/catalina/servlets/WebdavServlet.java
index b184cf2368..cd9d6a24d7 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -217,7 +217,7 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen
* Key : path <br>
* Value : LockInfo
*/
- private final Map<String,LockInfo> resourceLocks = new ConcurrentHashMap<>();
+ private final ConcurrentHashMap<String,LockInfo> resourceLocks = new ConcurrentHashMap<>();
/**
@@ -227,13 +227,13 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen
* Value : List of lock-null resource which are members of the collection. Each element of the List is the path
* associated with the lock-null resource.
*/
- private final Map<String,List<String>> lockNullResources = new ConcurrentHashMap<>();
+ private final ConcurrentHashMap<String,CopyOnWriteArrayList<String>> lockNullResources = new ConcurrentHashMap<>();
/**
* List of the inheritable collection locks.
*/
- private final List<LockInfo> collectionLocks = Collections.synchronizedList(new ArrayList<>());
+ private final CopyOnWriteArrayList<LockInfo> collectionLocks = new CopyOnWriteArrayList<>();
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org