[
https://issues.apache.org/jira/browse/SOLR-7486?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14519806#comment-14519806
]
Shai Erera commented on SOLR-7486:
----------------------------------
This is the usual pattern when deprecating code - you make the deprecated code
call the non-deprecated code (when possible). Also in this case users have to
call super.shutdown() to close the client.
In my case I need to provide my own HttpClient which I cannot save a reference
to outside HttpSolrClient. So I pass my custom HttpClient to HttpSolrClient
constructor. However, that makes HttpSolrClient determine my client isn't an
internalClient, and therefore it doesn't close it on shutdown/close. I need to
do it myself, only I now need to override both close() and shutdown().
With this change, and in the context of HttpSolrClient, I believe this patch is
OK. It follows usual deprecation practice (at least that I've seen), it ensures
the HttpClient is closed if you call either shutdown or close, it doesn't
impact users who only override shutdown(), since as you mentioned, they need to
call super.shutdown() already and when the day comes and we remove this
deprecated API, we only need to delete the method, and not worry about copying
code to close().
BTW, are we really going to carry this API 'till 6.0? If not, it's been
deprecated in 5.0 and 5.1, and we can just remove it now ...
> HttpSolrClient.shutdown() should call close() and not vice versa
> ----------------------------------------------------------------
>
> Key: SOLR-7486
> URL: https://issues.apache.org/jira/browse/SOLR-7486
> Project: Solr
> Issue Type: Bug
> Reporter: Shai Erera
> Assignee: Shai Erera
> Fix For: 5.2
>
> Attachments: SOLR-7486.patch
>
>
> HttpSolrClient.shutdown() is deprecated, however close() calls it instead of
> the other way around. If anyone extends HttpSolrClient, he needs to override
> both methods to make sure things are closed properly.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]