diff options
author | Antonio Barone <syntonyze@gmail.com> | 2022-01-20 17:13:12 +0100 |
---|---|---|
committer | Antonio Barone <syntonyze@gmail.com> | 2022-01-20 17:52:04 +0100 |
commit | a07b01bf104448ae6f19c820d12cbbd403b327bc (patch) | |
tree | baebaa8404c4bdc09ad1630cc4255066e5ab214d | |
parent | d55debe442ca787fb524d703c10258c8d680fad2 (diff) |
Make default CacheBasedWebSession maxAge public
Change the visibility of CacheBasedWebSession.MAX_AGE_MINUTES from
protected to public, in order to allow plugins to read this value
directly rather than duplicate it.
For example, websession-flatfile needs access to this value in order to
match the default of cache.web_sessions.maxAge when performing clean up
(see [1]).
[1] https://gerrit-review.googlesource.com/c/plugins/websession-flatfile/+/328562
Change-Id: Ib514e4e6a78b5c11f2e0dc9467c0869f8cdf3473
-rw-r--r-- | java/com/google/gerrit/common/UsedAt.java | 1 | ||||
-rw-r--r-- | java/com/google/gerrit/httpd/CacheBasedWebSession.java | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/java/com/google/gerrit/common/UsedAt.java b/java/com/google/gerrit/common/UsedAt.java index 73b1d40327..3e103c8625 100644 --- a/java/com/google/gerrit/common/UsedAt.java +++ b/java/com/google/gerrit/common/UsedAt.java @@ -42,6 +42,7 @@ public @interface UsedAt { PLUGIN_SERVICEUSER, PLUGIN_HIGH_AVAILABILITY, PLUGIN_MULTI_SITE, + PLUGIN_WEBSESSION_FLATFILE, PLUGINS_ALL, // Use this project if a method/type is generally made available to all plugins. } diff --git a/java/com/google/gerrit/httpd/CacheBasedWebSession.java b/java/com/google/gerrit/httpd/CacheBasedWebSession.java index 3a84a296f8..3ea73c3d2c 100644 --- a/java/com/google/gerrit/httpd/CacheBasedWebSession.java +++ b/java/com/google/gerrit/httpd/CacheBasedWebSession.java @@ -19,6 +19,7 @@ import static java.util.concurrent.TimeUnit.HOURS; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Strings; import com.google.gerrit.common.Nullable; +import com.google.gerrit.common.UsedAt; import com.google.gerrit.entities.Account; import com.google.gerrit.extensions.restapi.BadRequestException; import com.google.gerrit.httpd.WebSessionManager.Key; @@ -43,7 +44,9 @@ import org.eclipse.jgit.http.server.GitSmartHttpTools; @RequestScoped public abstract class CacheBasedWebSession implements WebSession { @VisibleForTesting public static final String ACCOUNT_COOKIE = "GerritAccount"; - protected static final long MAX_AGE_MINUTES = HOURS.toMinutes(12); + + @UsedAt(UsedAt.Project.PLUGIN_WEBSESSION_FLATFILE) + public static final long MAX_AGE_MINUTES = HOURS.toMinutes(12); private final HttpServletRequest request; private final HttpServletResponse response; |