Skip to content

Commit

Permalink
[linuxinput] improve thread names (openhab#9582)
Browse files Browse the repository at this point in the history
See openhab#9581

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
  • Loading branch information
t-8ch authored and thinkingstone committed Nov 7, 2021
1 parent 24dc1e5 commit 97e1e15
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public final void initialize() {
logger.warn("Could not read event", e);
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
}
}, getClass(), getInstanceName());
}, "events", thing);
thread.start();
worker = thread;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ protected void startBackgroundDiscovery() {
waitForNewDevices(watcher);
return null;
});
Thread t = Utils.backgroundThread(job, getClass(), null);
Thread t = Utils.backgroundThread(job, "discovery", null);
t.start();
discoveryJob = job;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.thing.Thing;

/**
* Utilities
Expand All @@ -25,10 +26,10 @@ class Utils {
private Utils() {
}

static Thread backgroundThread(Runnable r, Class<?> clazz, @Nullable String instance) {
String name = LinuxInputBindingConstants.BINDING_ID + " :: " + clazz.getSimpleName();
if (instance != null) {
name += " :: " + instance;
static Thread backgroundThread(Runnable r, String type, @Nullable Thing thing) {
String name = "OH-binding-" + LinuxInputBindingConstants.BINDING_ID + "-" + type;
if (thing != null) {
name += "-" + thing.getUID();
}
Thread t = new Thread(r, name);
t.setDaemon(true);
Expand Down

0 comments on commit 97e1e15

Please sign in to comment.