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

Uwe Schindler commented on LUCENE-8738:
---------------------------------------

Hi [~erickerickson], [[email protected]]:

I changed the stuff using the listeners with obersver pattern to be more 
useable. Here is the patch (to current branch code): 
[^LUCENE-8738-solr-CoreCloseListener.patch] 

Basically this somehow restores the same pattern like before, but type safe. 
The problem with Adriens approach was, that any subclass of the default 
implementation was not able to interact with the container. The reason was the 
private "pcs" field. Also it was "knowledge" needed how to execatly send the 
notifications.

This patch adds in the abstract base class the notification algorithm. Instead 
of TransientSolrCoreCache extending Observable, this adds the important methods 
as protected final methods (so it basically behaves like the one before, just 
method names are different). This has its internal PropertyChangeSupport as an 
implementation detail. Using the three methods you can register a 
CoreCloseListener (a new interface extening PropertyChangeListener, but 
type-safe), notify the listeners and finally remove the listener. SolrCores 
implements the new interface.

It should be super-easy to rewrite old code: just replace the method name, as 
shown in the javadocs. If you agree that this is better, I will commit it to 
the branch and add Javadocs at "breaking changes".

Nevertheless, I still thing the whole Obersver/Observable pattern is 
"overengineered": With the current default implementation there is only ever 
ONE listener added (SolrCores) and when notifying it, it just calls its method. 
So maybe the whole thing can be done much easier by just calling 
"SolrCores.queueCoreClose()" from the implementation directly...

Uwe

> Bump minimum Java version requirement to 11
> -------------------------------------------
>
>                 Key: LUCENE-8738
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8738
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: general/build
>            Reporter: Adrien Grand
>            Priority: Minor
>              Labels: Java11
>             Fix For: master (9.0)
>
>         Attachments: LUCENE-8738-solr-CoreCloseListener.patch
>
>
> See vote thread for reference: https://markmail.org/message/q6ubdycqscpl43aq.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to