[linuxinput] improve thread names (#9582)
See #9581 Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
This commit is contained in:
@@ -63,7 +63,7 @@ public abstract class DeviceReadingHandler extends BaseThingHandler {
|
|||||||
logger.warn("Could not read event", e);
|
logger.warn("Could not read event", e);
|
||||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
|
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
}, getClass(), getInstanceName());
|
}, "events", thing);
|
||||||
thread.start();
|
thread.start();
|
||||||
worker = thread;
|
worker = thread;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public class LinuxInputDiscoveryService extends AbstractDiscoveryService {
|
|||||||
waitForNewDevices(watcher);
|
waitForNewDevices(watcher);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
Thread t = Utils.backgroundThread(job, getClass(), null);
|
Thread t = Utils.backgroundThread(job, "discovery", null);
|
||||||
t.start();
|
t.start();
|
||||||
discoveryJob = job;
|
discoveryJob = job;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ package org.openhab.binding.linuxinput.internal;
|
|||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
import org.openhab.core.thing.Thing;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utilities
|
* Utilities
|
||||||
@@ -25,10 +26,10 @@ class Utils {
|
|||||||
private Utils() {
|
private Utils() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static Thread backgroundThread(Runnable r, Class<?> clazz, @Nullable String instance) {
|
static Thread backgroundThread(Runnable r, String type, @Nullable Thing thing) {
|
||||||
String name = LinuxInputBindingConstants.BINDING_ID + " :: " + clazz.getSimpleName();
|
String name = "OH-binding-" + LinuxInputBindingConstants.BINDING_ID + "-" + type;
|
||||||
if (instance != null) {
|
if (thing != null) {
|
||||||
name += " :: " + instance;
|
name += "-" + thing.getUID();
|
||||||
}
|
}
|
||||||
Thread t = new Thread(r, name);
|
Thread t = new Thread(r, name);
|
||||||
t.setDaemon(true);
|
t.setDaemon(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user