Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4964454

StreamHandler swallows thread interrupts

XMLWordPrintable

      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.

            Unassigned Unassigned
            mwarressunw Michael Warres (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: