NeuronRobotics / nrjavaserial

A Java Serial Port system. This is a fork of the RXTX project that uses in jar loading of the native code.
Other
345 stars 143 forks source link

Use named threads #138

Closed wborn closed 5 years ago

wborn commented 5 years ago

It would be easier to debug Java issues when the MonitorThread gets a proper name instead of something like Thread-130:

Karaf

openhab> threads --list                                                                                                                                                                                                                                                 
Id  │ Name                                                                                           │ State         │ CPU time │ Usr time
────┼────────────────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────┼─────────
1   │ main                                                                                           │ WAITING       │ 367      │ 320
2   │ Reference Handler                                                                              │ WAITING       │ 15       │ 10
3   │ Finalizer                                                                                      │ WAITING       │ 20       │ 20
5   │ Signal Dispatcher                                                                              │ RUNNABLE      │ 0        │ 0
...
441 │ Thread-130                                                                                     │ RUNNABLE      │ 298      │ 140
openhab> threads
...
"Thread-130" Id=441 in RUNNABLE (running in native)
    at gnu.io.RXTXPort.eventLoop(Native Method)
    at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1611)
...

Visual VM

thread130