Error Handling and Retry Logic
DWR has built in retry logic for reverse AJAX calls. The first failure will result in the errorHandler being called then the retry logic will be initiated. There are three properties in engine.js that apply:
- maxRetries (dwr.engine.setMaxRetries) - The number of times we should re-attempt failed calls after DWR has went offline. Defaults to -1, unlimited.
- retryIntervals (dwr.engine.setRetryIntervals) - An array specifying the default time between retries (in seconds). Defaults to: [ 1, 1, 10 ]
- retryIntervals.length - 1 = The number of retry attempts until DWR is offline.
- retryIntervals[retryIntervals.length - 1] = The interval used to poll the server while DWR is offline.
- pollStatusHandler (dwr.engine.setPollStatusHandler) - Function called when the DWR comes online or goes offline.
A working example of the retry logic can be seen in the dwr.war - clock example.