only:nicer java thread names
This commit is contained in:
parent
2c764279a8
commit
58db9656ee
|
@ -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.setDaemon(true);
|
||||||
thread.start();
|
thread.start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,7 +196,7 @@ public class LinkManager implements Closeable {
|
||||||
public final ExecutorService COMMUNICATION_EXECUTOR = new ThreadPoolExecutor(1, 1,
|
public final ExecutorService COMMUNICATION_EXECUTOR = new ThreadPoolExecutor(1, 1,
|
||||||
0L, TimeUnit.MILLISECONDS,
|
0L, TimeUnit.MILLISECONDS,
|
||||||
COMMUNICATION_QUEUE,
|
COMMUNICATION_QUEUE,
|
||||||
new NamedThreadFactory("communication executor", true));
|
new NamedThreadFactory("ECU Communication Executor", true));
|
||||||
|
|
||||||
public void assertCommunicationThread() {
|
public void assertCommunicationThread() {
|
||||||
if (Thread.currentThread() != communicationThread) {
|
if (Thread.currentThread() != communicationThread) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class SerialIoStream extends AbstractIoStream {
|
||||||
static {
|
static {
|
||||||
log.info("Using com.fazecast.jSerialComm " + SerialPort.getVersion());
|
log.info("Using com.fazecast.jSerialComm " + SerialPort.getVersion());
|
||||||
// NamedThreadFactory has daemon=false by default and we like that!
|
// 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) {
|
public SerialIoStream(@Nullable SerialPort sp, String port) {
|
||||||
|
@ -102,7 +102,6 @@ public class SerialIoStream extends AbstractIoStream {
|
||||||
if (sp == null)
|
if (sp == null)
|
||||||
return;
|
return;
|
||||||
sp.addDataListener(new SerialPortDataListener() {
|
sp.addDataListener(new SerialPortDataListener() {
|
||||||
private boolean isFirstEvent = true;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getListeningEvents() {
|
public int getListeningEvents() {
|
||||||
|
@ -124,11 +123,6 @@ requires jSerialComm newer than 2.7
|
||||||
*/
|
*/
|
||||||
if (event.getEventType() != SerialPort.LISTENING_EVENT_DATA_AVAILABLE)
|
if (event.getEventType() != SerialPort.LISTENING_EVENT_DATA_AVAILABLE)
|
||||||
return;
|
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();
|
int bytesAvailable = sp.bytesAvailable();
|
||||||
if (Bug3923.obscene)
|
if (Bug3923.obscene)
|
||||||
log.info("serialEvent bytesAvailable " + bytesAvailable);
|
log.info("serialEvent bytesAvailable " + bytesAvailable);
|
||||||
|
|
Loading…
Reference in New Issue