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

Konrad Windszus commented on SLING-6522:
----------------------------------------

I propose to deal with the error cases from above with the following changes in 
the code

* Catch any runtime exception thrown from {{InstallTask.execute(...)}} within 
the {{OsgiInstallerImpl}}, log that appropriately and then mark the resource as 
ignored. The javadoc of {{InstallTask.execute(...)}} should be extended 
accordingly. That would cover case 1).
* Add a new method called {{scheduleImmediateRetry}} to {{InstallTask}}. That 
method should optionally take a parameter {{sleepTimeMs}} to defer the retry 
attempt by the given amount of milliseconds. That would cover case 2).
* Add a new method called {{scheduleRetryInNextCycle}} to {{InstallTask}}. That 
would cover case 3).
* The retry counter would be managed within the {{OsgiInstallerImpl}}. The 
number of retries is configurable through an OSGi property (global value, 
effective for all tasks leveraging the new retry mechanism). Once the counter 
reaches 0 an according exception should be thrown and the according resource 
should be marked as ignored.

Of course any task is free to not use the retry handling at all and just leave 
the resource in the current state. Then it would be called again with the next 
cycle (without any retry counter mechanism). That would work exactly as it 
works right now.

> Refactor/Improve error handling of InstallTaskFactorys
> ------------------------------------------------------
>
>                 Key: SLING-6522
>                 URL: https://issues.apache.org/jira/browse/SLING-6522
>             Project: Sling
>          Issue Type: Improvement
>          Components: Installer
>    Affects Versions: Installer Core 3.8.0
>            Reporter: Konrad Windszus
>            Assignee: Konrad Windszus
>
> Currently the retry behaviour and exception handling needs to be done in each 
> {{InstallTaskFactory}} individually. It would be good to have a global 
> handling in the OSGi Installer, which could be easily triggered from the 
> individual transformers.
> The desired approach is outlined in 
> http://www.mail-archive.com/[email protected]/msg60947.html. 
> Basically we have to distinguish between the following error cases:
> # Unrecoverable error, an error which will occur with every retry, therefore 
> there is no need to try to execute the same transformer on the same resource 
> again.
> # Recoverable error, the retry should happen immediately or after a short 
> waiting time (independent of other OSGi Installer events)
> # Recoverable error, the retry should happen with the next cycle of the OSGi 
> Installer



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to