only:nicer java thread names

This commit is contained in:
rusefillc 2023-07-04 11:22:38 -04:00
parent 2c764279a8
commit 58db9656ee
3 changed files with 3 additions and 9 deletions

View File

@ -119,7 +119,7 @@ public class CommandQueue {
}
}
};
Thread thread = new Thread(runnable, "Commands Queue");
Thread thread = new Thread(runnable, "ECU Commands Queue");
thread.setDaemon(true);
thread.start();
}

View File

@ -196,7 +196,7 @@ public class LinkManager implements Closeable {
public final ExecutorService COMMUNICATION_EXECUTOR = new ThreadPoolExecutor(1, 1,
0L, TimeUnit.MILLISECONDS,
COMMUNICATION_QUEUE,
new NamedThreadFactory("communication executor", true));
new NamedThreadFactory("ECU Communication Executor", true));
public void assertCommunicationThread() {
if (Thread.currentThread() != communicationThread) {

View File

@ -27,7 +27,7 @@ public class SerialIoStream extends AbstractIoStream {
static {
log.info("Using com.fazecast.jSerialComm " + SerialPort.getVersion());
// NamedThreadFactory has daemon=false by default and we like that!
SerialPortThreadFactory.set(new NamedThreadFactory("jSerialComm"));
SerialPortThreadFactory.set(new NamedThreadFactory("ECU SerialIoStream jSerialComm"));
}
public SerialIoStream(@Nullable SerialPort sp, String port) {
@ -102,7 +102,6 @@ public class SerialIoStream extends AbstractIoStream {
if (sp == null)
return;
sp.addDataListener(new SerialPortDataListener() {
private boolean isFirstEvent = true;
@Override
public int getListeningEvents() {
@ -124,11 +123,6 @@ requires jSerialComm newer than 2.7
*/
if (event.getEventType() != SerialPort.LISTENING_EVENT_DATA_AVAILABLE)
return;
if (isFirstEvent) {
// a hack to have explicit thread name, see https://github.com/Fazecast/jSerialComm/issues/308
Thread.currentThread().setName("Serial Port Event Thread");
isFirstEvent = false;
}
int bytesAvailable = sp.bytesAvailable();
if (Bug3923.obscene)
log.info("serialEvent bytesAvailable " + bytesAvailable);