commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (IO-357) [Tailer] InterruptedException while the thead is sleeping is silently ignored
Date Thu, 22 Nov 2012 00:36:58 GMT

     [ https://issues.apache.org/jira/browse/IO-357?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Gary Gregory resolved IO-357.
-----------------------------

       Resolution: Fixed
    Fix Version/s: 2.5

{noformat}
commit -m "[IO-358][Tailer] InterruptedException while the thread is sleeping is silently
ignored." C:/svn/org/apache/commons/trunks-proper/io/src/test/java/org/apache/commons/io/input/TailerTest.java
C:/svn/org/apache/commons/trunks-proper/io/src/main/java/org/apache/commons/io/input/Tailer.java
C:/svn/org/apache/commons/trunks-proper/io/src/changes/changes.xml
    Sending        C:/svn/org/apache/commons/trunks-proper/io/src/changes/changes.xml
    Sending        C:/svn/org/apache/commons/trunks-proper/io/src/main/java/org/apache/commons/io/input/Tailer.java
    Sending        C:/svn/org/apache/commons/trunks-proper/io/src/test/java/org/apache/commons/io/input/TailerTest.java
    Transmitting file data ...
    Committed revision 1412391.
{noformat}
                
> [Tailer] InterruptedException while the thead is sleeping is silently ignored
> -----------------------------------------------------------------------------
>
>                 Key: IO-357
>                 URL: https://issues.apache.org/jira/browse/IO-357
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Streams/Writers
>    Affects Versions: 2.4
>            Reporter: Morten Hattesen
>             Fix For: 2.5
>
>
> The implementation of org.apache.commons.io.input.Tailer silently ignores interruptions
while sleeping (in two places).
> Source snippet:
> {code}
> 360	                    try {
> 361	                        Thread.sleep(delayMillis);
> 362	                    } catch (InterruptedException e) {
> 363	                    }
> ...
> 425	                try {
> 426	                    Thread.sleep(delayMillis);
> 427	                } catch (InterruptedException e) {
> 428	                }
> {code}
> This is an inappropriate behavior, since it prevents controlled shutdown by a container.
> This may be rectified in one of these ways:
> # Declare the method as "throws InterruptedException" and re-throw the InterruptedException,
after possibly performing come cleanup, or removing the catch clause entirely. This will ensure
that a thread interruption (possibly caused by the forced shutdown by a container) will cause
processing to stop, and shutdown to proceed. Problem: Requires backwards incompatible change
to method signature.
> # Treat an interrupt as an alternate way of signalling the Tailer to stop, by calling
{{stop()}} in the catch clause.
> # Reassert the interrupted state of the thread by calling {{Thread.currentThread.interrupt()}}
to be able to detect the interruption at a later stage.
> For reference, please refer to these resources about handling thread interruption:
> * http://www.ibm.com/developerworks/java/library/j-jtp05236/index.html
> * Java Concurrency in Practice http://www.javaconcurrencyinpractice.com/

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message