summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNasser Grainawi <nasser.grainawi@linaro.org>2023-05-05 16:20:50 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-05-05 16:20:50 +0000
commit4736d56aa47b77bf93d5ecad80ccb3b1e275506e (patch)
treea613d5109dc154779d15a3ecb47a927b40435dfc
parente0dcd19e96955c6d526538f60d4b1e1a8107bfcb (diff)
parent2ca5ed5037506d19cef2e37a3818a4b61f76eaa4 (diff)
Merge "Move creation of PerThreadCache to SshCommand" into stable-3.5
-rw-r--r--java/com/google/gerrit/server/query/change/OutputStreamQuery.java3
-rw-r--r--java/com/google/gerrit/sshd/SshCommand.java4
2 files changed, 4 insertions, 3 deletions
diff --git a/java/com/google/gerrit/server/query/change/OutputStreamQuery.java b/java/com/google/gerrit/server/query/change/OutputStreamQuery.java
index 716cf106d2..961404adb7 100644
--- a/java/com/google/gerrit/server/query/change/OutputStreamQuery.java
+++ b/java/com/google/gerrit/server/query/change/OutputStreamQuery.java
@@ -30,7 +30,6 @@ import com.google.gerrit.index.query.QueryParseException;
import com.google.gerrit.index.query.QueryResult;
import com.google.gerrit.server.DynamicOptions;
import com.google.gerrit.server.account.AccountAttributeLoader;
-import com.google.gerrit.server.cache.PerThreadCache;
import com.google.gerrit.server.config.TrackingFooters;
import com.google.gerrit.server.data.ChangeAttribute;
import com.google.gerrit.server.data.PatchSetAttribute;
@@ -211,7 +210,7 @@ public class OutputStreamQuery {
return;
}
- try (PerThreadCache ignored = PerThreadCache.create()) {
+ try {
final QueryStatsAttribute stats = new QueryStatsAttribute();
stats.runTimeMilliseconds = TimeUtil.nowMs();
diff --git a/java/com/google/gerrit/sshd/SshCommand.java b/java/com/google/gerrit/sshd/SshCommand.java
index 9df263b860..a4e427d1eb 100644
--- a/java/com/google/gerrit/sshd/SshCommand.java
+++ b/java/com/google/gerrit/sshd/SshCommand.java
@@ -23,6 +23,7 @@ import com.google.gerrit.server.DynamicOptions;
import com.google.gerrit.server.InvalidDeadlineException;
import com.google.gerrit.server.RequestInfo;
import com.google.gerrit.server.RequestListener;
+import com.google.gerrit.server.cache.PerThreadCache;
import com.google.gerrit.server.cancellation.RequestCancelledException;
import com.google.gerrit.server.cancellation.RequestStateContext;
import com.google.gerrit.server.config.GerritServerConfig;
@@ -62,7 +63,8 @@ public abstract class SshCommand extends BaseCommand {
public void start(ChannelSession channel, Environment env) throws IOException {
startThread(
() -> {
- try (DynamicOptions pluginOptions = new DynamicOptions(injector, dynamicBeans)) {
+ try (PerThreadCache ignored = PerThreadCache.create();
+ DynamicOptions pluginOptions = new DynamicOptions(injector, dynamicBeans)) {
parseCommandLine(pluginOptions);
stdout = toPrintWriter(out);
stderr = toPrintWriter(err);