WorkQueue: Pipe description of work item through to set thread name

Change-Id: I8395512ad0b30d05281a06f3730aa60d1a3b4c5e
This commit is contained in:
Patrick Hiesel
2020-05-29 14:13:17 +02:00
parent b2c8716ec1
commit 699ff3c9f6
2 changed files with 9 additions and 1 deletions

View File

@@ -606,9 +606,12 @@ public class WorkQueue {
@Override
public void run() {
if (running.compareAndSet(false, true)) {
String oldThreadName = Thread.currentThread().getName();
try {
Thread.currentThread().setName(oldThreadName + "[" + task.toString() + "]");
task.run();
} finally {
Thread.currentThread().setName(oldThreadName);
if (isPeriodic()) {
running.set(false);
} else {
@@ -681,5 +684,10 @@ public class WorkQueue {
public boolean hasCustomizedPrint() {
return runnable.hasCustomizedPrint();
}
@Override
public String toString() {
return runnable.toString();
}
}
}