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

Timothee Maret edited comment on SLING-4685 at 4/30/15 4:11 PM:
----------------------------------------------------------------

Handlers may take a a considerable time to process the events.
Assuming the newEvent MUST be "current", then during the time required to 
process the events, all other methods of the manager must be blocked (because 
you can't make the current view "not current" until all listeners have received 
an update). An improvement would be to queue to events (including the view 
states) for dispatching (and therefor the manager would not block anymore).

However, I wonder if receiving a "current" view when the viewManager knows it 
has changed is useful.
It cause listeners to think a view is current when in fact it is not.

Maybe we could amend the API from
{quote}
Returns the view which is currently (i.e. newly) valid.
{quote}
to
{quote}
Returns the view which is valid at the time of dispatching.
{quote}

wdyt ?


was (Author: marett):
Handlers may take a a considerable time to process the events.
Assuming the newEvent MUST be "current", then during the time required to 
process the events, all other methods of the manager must be blocked (because 
you can't make the current view "not current" until all listeners have received 
an update). An improvement would be to queue to events (including the view 
states) for dispatching (and therefor the manager would not block anymore).

However, I wonder if receiving a "current" view when the viewManager knows it 
has changed is useful.
It cause listeners to think a view is current when in fact it is not.

Maybe we could amend the API from
{quote}
Returns the view which is currently (i.e. newly) valid.
{quote}
to
{quote}
Returns the view which was current at the time of dispatching.
{quote}

wdyt ?

> Introduce generic discovery.commons.ViewStateManager sharable for impls
> -----------------------------------------------------------------------
>
>                 Key: SLING-4685
>                 URL: https://issues.apache.org/jira/browse/SLING-4685
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Stefan Egli
>            Assignee: Stefan Egli
>             Fix For: Discovery Commons 1.0.0
>
>         Attachments: SLING-4685.patch
>
>
> With multiple discovery implementations existing/upcoming it starts to become 
> valuable to share code that can be shared. And with the introduction of 
> discovery.commons we have a nice place for this.
> As a first thing, I propose to introduce a discovery.commons.ViewStateManager 
> (the name can be changed if wished of course): this one is capable of 
> managing a number of TopologyChangeListeners, can be in deactivated/activated 
> state and can react on {{handleChanging}} and {{handleNewView}} events and 
> translates all of those to correct events that it sends to the registered 
> listeners accordingly.
> This also takes into account the fact that the TOPOLOGY_INIT should be sent 
> only when the first valid view is available - which is flagged to 
> ViewStateManager via {{handleNewView}}.



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

Reply via email to