You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2022/09/23 01:45:09 UTC
[james-project] 05/05: JAMES-3744 remove redundant hashmaps which lead to OOM
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch 3.7.x
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit ef062ac82187f886d7eabc6b9bca902109f78448
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Apr 8 21:08:46 2022 +0700
JAMES-3744 remove redundant hashmaps which lead to OOM
Upstream https://github.com/reactor/reactor-netty/commit/fe6653fac44df16664bdd0628ad56cd142175bca
(cherry picked from commit 06260220051a42522ff501e75f689d59f640744d)
---
.../org/apache/james/jmap/UriPathTemplate.java | 23 ++--------------------
1 file changed, 2 insertions(+), 21 deletions(-)
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/UriPathTemplate.java b/server/protocols/jmap/src/main/java/org/apache/james/jmap/UriPathTemplate.java
index 6c158a9951..902cdb27cc 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/UriPathTemplate.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/UriPathTemplate.java
@@ -52,10 +52,6 @@ public class UriPathTemplate {
private final List<String> pathVariables =
new ArrayList<>();
- private final HashMap<String, Matcher> matchers =
- new HashMap<>();
- private final HashMap<String, Map<String, String>> vars =
- new HashMap<>();
private final Pattern uriPattern;
@@ -126,14 +122,7 @@ public class UriPathTemplate {
private Matcher matcher(String uri) {
uri = filterQueryParams(uri);
- Matcher m = matchers.get(uri);
- if (null == m) {
- m = uriPattern.matcher(uri);
- synchronized (matchers) {
- matchers.put(uri, m);
- }
- }
- return m;
+ return uriPattern.matcher(uri);
}
/**
@@ -146,12 +135,7 @@ public class UriPathTemplate {
* @return the path parameters from the uri. Never {@code null}.
*/
final Map<String, String> match(String uri) {
- Map<String, String> pathParameters = vars.get(uri);
- if (null != pathParameters) {
- return pathParameters;
- }
-
- pathParameters = new HashMap<>();
+ Map<String, String> pathParameters = new HashMap<>();
Matcher m = matcher(uri);
if (m.matches()) {
int i = 1;
@@ -160,9 +144,6 @@ public class UriPathTemplate {
pathParameters.put(name, val);
}
}
- synchronized (vars) {
- vars.put(uri, pathParameters);
- }
return pathParameters;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org