Methods that Clear the Thread.interrupt() flag

后端 未结 3 1761
伪装坚强ぢ
伪装坚强ぢ 2020-12-01 06:03

I have recently inherited a large Java Application that has almost no Thread safety in it. What I\'m currently working on is getting all of the Threads to correctly handle b

3条回答
  •  隐瞒了意图╮
    2020-12-01 06:11

    Here's a SUPER FUN EXAMPLE:

    ch.qos.logback.core.AsyncAppenderBase prior to version 1.1.4 catches and swallows InterruptedException without resetting the flag on the thread.

    So, if you use anything which routes to this logger (like slf4j), it will silently eat your thread interrupt status. 'Cos, I mean, who doesn't check thread interrupt status before and after every possible log operation?

提交回复
热议问题