summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNasser Grainawi <nasser.grainawi@linaro.org>2023-12-21 09:09:50 -0700
committerNasser Grainawi <nasser.grainawi@linaro.org>2024-05-16 20:05:35 +0000
commitfee9d5850ef3478b48d7864b068a5274736b2fc4 (patch)
treec9a5bd92ab944325ad5e47ce95de3bb30a972207
parent112095f8440b38f4200e8c97f497e3a4d9412534 (diff)
WorkQueue: Improve task thread names
The RunnableScheduledFuture task inside a Task has a few layers that don't help provide a meaningful thread name whereas the Task itself often has a toString() that does, so use the Task itself. Here's an example for a SendEmail thread. It's a similar result for Index-Interactive and other threads. Before (line breaks added by me): SendEmail-1[ java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@57310449[ Not completed, task = java.util.concurrent.Executors$RunnableAdapter@3a7a2870[ Wrapped task = com.google.gerrit.server.logging.LoggingContextAwareRunnable@9252ca5 ] ] ] After: SendEmail-1[send-email comments] Change-Id: Iea78b6412b2259a968eed0a16744638f87796d91 Release-Notes: Improved WorkQueue task thread names (cherry picked from commit d4c1e0a6ed7eb2b8fffa078a7ccec0c0edb0e668)
-rw-r--r--java/com/google/gerrit/server/git/WorkQueue.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/java/com/google/gerrit/server/git/WorkQueue.java b/java/com/google/gerrit/server/git/WorkQueue.java
index 86d6c7c7d2..ce2d5b654c 100644
--- a/java/com/google/gerrit/server/git/WorkQueue.java
+++ b/java/com/google/gerrit/server/git/WorkQueue.java
@@ -695,7 +695,7 @@ public class WorkQueue {
try {
executor.onStart(this);
runningState.set(State.RUNNING);
- Thread.currentThread().setName(oldThreadName + "[" + task.toString() + "]");
+ Thread.currentThread().setName(oldThreadName + "[" + this + "]");
task.run();
} finally {
Thread.currentThread().setName(oldThreadName);