[
https://issues.apache.org/jira/browse/SOLR-4872?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13683402#comment-13683402
]
Yonik Seeley commented on SOLR-4872:
------------------------------------
bq. For individual objects of shorter lifetime, finalizers are more of a
problem.
Right, but I'm not proposing adding any new finalizers in lucene/solr - I was
proposing you solve your specific issue that way.
Here's the thing: guaranteeing that you call close() once and only once after
all users are done with an object adds a lot of complexity and constrains
implementation. The schema sharing code is likely to change in the future esp
as we move toward named schemas, and I imagine sharing would be the default (I
can't imagine why it wouldn't be at least). Modifiable schemas (adding fields
/ field types) on the fly also complicate things, esp in the future if/when we
are able to change an existing field type. This would also constrain other
optimizations we might do like share common analysis components between
different field types. So the more I think about it, the more it seems like a
bad idea to have close() on FieldType and friends.
It seems fine to allow SolrCoreAware, and I could also see value in the
addition of a CoreContainer.addShutdownHook() as well.
> Allow schema analysis object factories to be cleaned up properly when the
> core shuts down
> -----------------------------------------------------------------------------------------
>
> Key: SOLR-4872
> URL: https://issues.apache.org/jira/browse/SOLR-4872
> Project: Solr
> Issue Type: Improvement
> Affects Versions: 4.3
> Reporter: Benson Margulies
> Attachments: solr-4872.patch, solr-4872.patch
>
>
> I have a need, in an TokenizerFactory or TokenFilterFactory, to have a shared
> cache that is cleaned up when the core is torn down.
> There is no 'close' protocol on these things, and Solr rejects analysis
> components that are SolrCoreAware.
> Possible solutions:
> # add a close protocol to these factories and make sure it gets called at
> core shutdown.
> # allow these items to be 'core-aware'.
> # invent some notion of 'schema-lifecycle-aware'.
--
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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]