[ 
https://jira.nuxeo.org/browse/NXP-5025?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=73186#action_73186
 ] 

Olivier Grisel commented on NXP-5025:
-------------------------------------

Right now the optimal way to avoid useless reconnection is as done in 
BulkLifeCycleChangeListener:

    public void handleEvent(EventBundle events) throws ClientException {
        if (!events.containsEventName(LifeCycleConstants.TRANSITION_EVENT)) {
            return;
        }
        for (Event event : events) {
            if (LifeCycleConstants.TRANSITION_EVENT.equals(event.getName())) {
                processTransition(event);
            }
        }
    }

Whit the new API it coud be:

    public void handleEvent(EventBundle events) throws ClientException {
        for (Event event : 
events.getFilteredEvents(Arrays.asList(LifeCycleConstants.TRANSITION_EVENT))) {
            processTransition(event);
        }
    }

Or even better, the event manager service could introspect the event listener 
descriptor to prefilter the event bundle in advance and only pass filtered 
bundles to the listeners. 




> Make EventBundle API natural to reconnect only events the listener is 
> interested in
> -----------------------------------------------------------------------------------
>
>                 Key: NXP-5025
>                 URL: https://jira.nuxeo.org/browse/NXP-5025
>             Project: Nuxeo Enterprise Platform
>          Issue Type: Improvement
>    Affects Versions: 5.3.1
>            Reporter: Olivier Grisel
>             Fix For: 5.3.2
>
>
> The current EventBundle iterator method trigger a reconnection (new core 
> session) even though the listener is listing the events to tell whether or 
> not it is interested in one of them.
> It would be better to have a EventBundle#getFilteredEvent(List<String> 
> interestingEventNames) that returns the events if the intersection of the 
> bundle and and the list of interested event names is not empty and hence only 
> reconnects them (creating the core session) is the list is not empty.
> some event listeners that might benefit from this optimization:
> - BinaryTextListener
> - AbstractCommentListener

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://jira.nuxeo.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
ECM-tickets mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets

Reply via email to