lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Risden (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SOLR-8190) Implement Closeable on TupleStream
Date Thu, 17 Dec 2015 14:58:46 GMT

    [ https://issues.apache.org/jira/browse/SOLR-8190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15062152#comment-15062152
] 

Kevin Risden commented on SOLR-8190:
------------------------------------

So I put more thought into this last night and since TupleStream has an open method it makes
try-with-resources not really applicable. In the case here, it will call close twice as implemented.
try-with-resources can't be pushed into getTuples since try-with-resources doesn't work with
a open method.

Thinking about this brought up the following thoughts:
* What should happen when open is called twice?
* What should happen when close is called twice?
* What should happen when close is called without open being called?
* Are there places in the code where open/close is called without a try/finally? Will that
cause issues?
* Are there places in the code where TupleStream.open is called without a related close call?

There are no checks currently to see if a stream has already been opened or closed. This is
what is causing the different NPE exceptions like in SOLR-8191.

For this ticket, I think just implementing Closeable on TupleStream and not changing the tests
is appropriate. The above items should be addressed though. This will make the patch smaller
and the tests can be improved in followup JIRAS.

[~joel.bernstein]/[~gerlowskija] - Thoughts on the above?

> Implement Closeable on TupleStream
> ----------------------------------
>
>                 Key: SOLR-8190
>                 URL: https://issues.apache.org/jira/browse/SOLR-8190
>             Project: Solr
>          Issue Type: Bug
>          Components: SolrJ
>    Affects Versions: Trunk
>            Reporter: Kevin Risden
>            Assignee: Joel Bernstein
>            Priority: Minor
>         Attachments: SOLR-8190.patch, SOLR-8190.patch
>
>
> Implementing Closeable on TupleStream provides the ability to use try-with-resources
(https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html) in tests
and in practice. This prevents TupleStreams from being left open when there is an error in
the tests.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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


Mime
View raw message