-
Bug
-
Resolution: Unresolved
-
P4
-
1.4.0
-
generic
-
generic
If an interrupt occurs while StreamHandler is writing data, the resulting
InterruptedIOException is caught and reported to the ErrorManager, but the
interrupt status of the current thread is not set. As a result, threads which
use logging can lose interrupts if they happen to occur while a log message is
being written.
In threads that use logging, one workaround is to override the interrupt method
to set a boolean "interrupted" flag (in addition to delegating to
super.interrupt()), and check this flag instead of calling
Thread.isInterrupted(). However, this has the disadvantage that the explicit
interrupt field is never cleared (there's no hook into Thread.interrupted()),
which can be problematic for threads which continue processing after handling
interrupts.
InterruptedIOException is caught and reported to the ErrorManager, but the
interrupt status of the current thread is not set. As a result, threads which
use logging can lose interrupts if they happen to occur while a log message is
being written.
In threads that use logging, one workaround is to override the interrupt method
to set a boolean "interrupted" flag (in addition to delegating to
super.interrupt()), and check this flag instead of calling
Thread.isInterrupted(). However, this has the disadvantage that the explicit
interrupt field is never cleared (there's no hook into Thread.interrupted()),
which can be problematic for threads which continue processing after handling
interrupts.