You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Michael McCandless (JIRA)" <ji...@apache.org> on 2009/11/11 01:51:27 UTC

[jira] Created: (LUCENE-2053) When thread is interrupted we should throw a clear exception

When thread is interrupted we should throw a clear exception
------------------------------------------------------------

                 Key: LUCENE-2053
                 URL: https://issues.apache.org/jira/browse/LUCENE-2053
             Project: Lucene - Java
          Issue Type: Improvement
          Components: Index
            Reporter: Michael McCandless
            Assignee: Michael McCandless
            Priority: Minor
             Fix For: 3.0


This is the 3.0 followon from LUCENE-1573.  We should throw a dedicated exception, not just RuntimeException.

Recent discussion from java-dev "Thread.interrupt()" subject: http://www.lucidimagination.com/search/document/8423f9f0b085034e/thread_interrupt

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-2053) When thread is interrupted we should throw a clear exception

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2053?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless updated LUCENE-2053:
---------------------------------------

    Attachment: LUCENE-2053.patch

Attached patch.

> When thread is interrupted we should throw a clear exception
> ------------------------------------------------------------
>
>                 Key: LUCENE-2053
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2053
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LUCENE-2053.patch
>
>
> This is the 3.0 followon from LUCENE-1573.  We should throw a dedicated exception, not just RuntimeException.
> Recent discussion from java-dev "Thread.interrupt()" subject: http://www.lucidimagination.com/search/document/8423f9f0b085034e/thread_interrupt

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Reopened: (LUCENE-2053) When thread is interrupted we should throw a clear exception

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2053?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless reopened LUCENE-2053:
----------------------------------------


Reopening to address buggy intermittent test failure...

> When thread is interrupted we should throw a clear exception
> ------------------------------------------------------------
>
>                 Key: LUCENE-2053
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2053
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LUCENE-2053.patch
>
>
> This is the 3.0 followon from LUCENE-1573.  We should throw a dedicated exception, not just RuntimeException.
> Recent discussion from java-dev "Thread.interrupt()" subject: http://www.lucidimagination.com/search/document/8423f9f0b085034e/thread_interrupt

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Resolved: (LUCENE-2053) When thread is interrupted we should throw a clear exception

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2053?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless resolved LUCENE-2053.
----------------------------------------

    Resolution: Fixed

OK, trying again!

> When thread is interrupted we should throw a clear exception
> ------------------------------------------------------------
>
>                 Key: LUCENE-2053
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2053
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LUCENE-2053.patch, LUCENE-2053.patch
>
>
> This is the 3.0 followon from LUCENE-1573.  We should throw a dedicated exception, not just RuntimeException.
> Recent discussion from java-dev "Thread.interrupt()" subject: http://www.lucidimagination.com/search/document/8423f9f0b085034e/thread_interrupt

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-2053) When thread is interrupted we should throw a clear exception

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12776982#action_12776982 ] 

Michael McCandless commented on LUCENE-2053:
--------------------------------------------

How about ThreadInterruptedException?  Maybe under oal.util?

I wouldn't restrict the name/scope to indexing.  Sure, maybe today you can't Thread.interrupt a Lucene search, but maybe in the future we'll allow that and then this same exception should be thrown.

I think it's cleaner to extend RuntimeException.  Right now (2.9) you get a RuntimeException, so extending IOException instead is more of a back compat break.

I just wish InterruptedException had been non-checked from the get-go...

> When thread is interrupted we should throw a clear exception
> ------------------------------------------------------------
>
>                 Key: LUCENE-2053
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2053
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 3.0
>
>
> This is the 3.0 followon from LUCENE-1573.  We should throw a dedicated exception, not just RuntimeException.
> Recent discussion from java-dev "Thread.interrupt()" subject: http://www.lucidimagination.com/search/document/8423f9f0b085034e/thread_interrupt

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-2053) When thread is interrupted we should throw a clear exception

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12776989#action_12776989 ] 

Uwe Schindler commented on LUCENE-2053:
---------------------------------------

So I think we go with RuntimeException.

- ThreadInterruptedException
- UnexpectedInterruptedException
- UncheckedInterruptedException

...

> When thread is interrupted we should throw a clear exception
> ------------------------------------------------------------
>
>                 Key: LUCENE-2053
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2053
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 3.0
>
>
> This is the 3.0 followon from LUCENE-1573.  We should throw a dedicated exception, not just RuntimeException.
> Recent discussion from java-dev "Thread.interrupt()" subject: http://www.lucidimagination.com/search/document/8423f9f0b085034e/thread_interrupt

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-2053) When thread is interrupted we should throw a clear exception

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12778139#action_12778139 ] 

Michael McCandless commented on LUCENE-2053:
--------------------------------------------

OK I'll commit shortly.

Basically, with the patch the test is now more careful: the main thread issues the interrupt, and then waits for the child thread to confirm it handled the exception.  This way the main thread won't send another interrupt until the child thread is done handling the last one.

> When thread is interrupted we should throw a clear exception
> ------------------------------------------------------------
>
>                 Key: LUCENE-2053
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2053
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LUCENE-2053.patch, LUCENE-2053.patch
>
>
> This is the 3.0 followon from LUCENE-1573.  We should throw a dedicated exception, not just RuntimeException.
> Recent discussion from java-dev "Thread.interrupt()" subject: http://www.lucidimagination.com/search/document/8423f9f0b085034e/thread_interrupt

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-2053) When thread is interrupted we should throw a clear exception

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12776973#action_12776973 ] 

Uwe Schindler commented on LUCENE-2053:
---------------------------------------

Here are some names for Exceptions:

- UnexpectedInterruptException extends RuntimeException
- IndexerInterruptedException extends RuntimeException
- IndexWriterInterruptedException extends RuntimeException
- SmartInterruptedException (just a joke)

Another possibility would be to use IOException as super class, this would enable users to catch it without changing code and they will correctly log the message and not fallback to default RuntimeException catch in JVM.

The patch is easy, you have to just find all Thread.interrupt() calls or catch InterruptedException in the code.

> When thread is interrupted we should throw a clear exception
> ------------------------------------------------------------
>
>                 Key: LUCENE-2053
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2053
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 3.0
>
>
> This is the 3.0 followon from LUCENE-1573.  We should throw a dedicated exception, not just RuntimeException.
> Recent discussion from java-dev "Thread.interrupt()" subject: http://www.lucidimagination.com/search/document/8423f9f0b085034e/thread_interrupt

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-2053) When thread is interrupted we should throw a clear exception

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12778122#action_12778122 ] 

Uwe Schindler commented on LUCENE-2053:
---------------------------------------

Patch looks good, even I do not understand it completely.

> When thread is interrupted we should throw a clear exception
> ------------------------------------------------------------
>
>                 Key: LUCENE-2053
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2053
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LUCENE-2053.patch, LUCENE-2053.patch
>
>
> This is the 3.0 followon from LUCENE-1573.  We should throw a dedicated exception, not just RuntimeException.
> Recent discussion from java-dev "Thread.interrupt()" subject: http://www.lucidimagination.com/search/document/8423f9f0b085034e/thread_interrupt

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-2053) When thread is interrupted we should throw a clear exception

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777026#action_12777026 ] 

Michael McCandless commented on LUCENE-2053:
--------------------------------------------

OK I'll go with ThreadInterruptedException!  I'll wait a while just in case someone has a violent reaction to that name ;)

> When thread is interrupted we should throw a clear exception
> ------------------------------------------------------------
>
>                 Key: LUCENE-2053
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2053
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 3.0
>
>
> This is the 3.0 followon from LUCENE-1573.  We should throw a dedicated exception, not just RuntimeException.
> Recent discussion from java-dev "Thread.interrupt()" subject: http://www.lucidimagination.com/search/document/8423f9f0b085034e/thread_interrupt

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Resolved: (LUCENE-2053) When thread is interrupted we should throw a clear exception

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2053?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless resolved LUCENE-2053.
----------------------------------------

    Resolution: Fixed

> When thread is interrupted we should throw a clear exception
> ------------------------------------------------------------
>
>                 Key: LUCENE-2053
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2053
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LUCENE-2053.patch
>
>
> This is the 3.0 followon from LUCENE-1573.  We should throw a dedicated exception, not just RuntimeException.
> Recent discussion from java-dev "Thread.interrupt()" subject: http://www.lucidimagination.com/search/document/8423f9f0b085034e/thread_interrupt

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-2053) When thread is interrupted we should throw a clear exception

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2053?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless updated LUCENE-2053:
---------------------------------------

    Attachment: LUCENE-2053.patch

Attached my current approach for fixing the test.

Includes a silly workaround to not let an interrupted thread hit the class loader.  Weird....



> When thread is interrupted we should throw a clear exception
> ------------------------------------------------------------
>
>                 Key: LUCENE-2053
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2053
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LUCENE-2053.patch, LUCENE-2053.patch
>
>
> This is the 3.0 followon from LUCENE-1573.  We should throw a dedicated exception, not just RuntimeException.
> Recent discussion from java-dev "Thread.interrupt()" subject: http://www.lucidimagination.com/search/document/8423f9f0b085034e/thread_interrupt

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org