Aria Templates Forums
Safer stop/resume for RefreshManager - Printable Version

+- Aria Templates Forums (http://ariatemplates.com/forum)
+-- Forum: Public forums (/forumdisplay.php?fid=3)
+--- Forum: Specifications (/forumdisplay.php?fid=13)
+--- Thread: Safer stop/resume for RefreshManager (/showthread.php?tid=195)



Safer stop/resume for RefreshManager - flongo - 17 March 2014 15:05

1. Requirements

Class [aria.templates.RefreshManager][http://www.ariatemplates.com/aria/guide/apps/apidocs/#aria.templates.RefreshManager] is responsible of refresh operations. It provides an API to stop and resume them. The code behind these methods just updates a counter so that, when the resume is called as many times as the stop method has been called before, refresh operations are executed.

This implementation is error-prone: if the resume is called erroneously called multiple time, it is likely that some errors occurs because refresh operations restart too early, when the entities that stopped it are not yet ready.

The stop/resume mechanism should be improved.


3. Technical solution

Here is the new signature suggested for the methods

/**
* Puts the Refresh Manager in "STOPPED" state, effectively causing all template/section/widget refreshes to be
* queued instead of being fired immediately.
[b] * @return {String} Return a unique id for this stop operation. It will have to be used in order to resume it
[/b] */
stop : function () {
},

...

/**
* Triggers the minimal set of refreshes which covers all the templates/sections/widgets found in the queue.
* Puts the Refresh Manager back in "RUNNING" state.
* @param {String} id Identifier of the corresponding stop operation
*/
resume : function (id) {
},
  • Class aria.templates.RefreshManager should keep an array of identifiers corresponding to different calls to the stop method.
  • When the resume method is called with the wrong indentifier, an error should be raised.


4. History

17/03/20104 Spec creation - Francesco Longo