mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[linuxinput] improve thread names (#9582)
See #9581 Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
This commit is contained in:
parent
d9caa46031
commit
217af3704e
@ -63,7 +63,7 @@ public abstract class DeviceReadingHandler extends BaseThingHandler {
|
||||
logger.warn("Could not read event", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
|
||||
}
|
||||
}, getClass(), getInstanceName());
|
||||
}, "events", thing);
|
||||
thread.start();
|
||||
worker = thread;
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ public class LinuxInputDiscoveryService extends AbstractDiscoveryService {
|
||||
waitForNewDevices(watcher);
|
||||
return null;
|
||||
});
|
||||
Thread t = Utils.backgroundThread(job, getClass(), null);
|
||||
Thread t = Utils.backgroundThread(job, "discovery", null);
|
||||
t.start();
|
||||
discoveryJob = job;
|
||||
} else {
|
||||
|
@ -14,6 +14,7 @@ package org.openhab.binding.linuxinput.internal;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.core.thing.Thing;
|
||||
|
||||
/**
|
||||
* Utilities
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user