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:

  1. maxRetries (dwr.engine.setMaxRetries) - The number of times we should re-attempt failed calls after DWR has went offline. Defaults to -1, unlimited.
  2. retryIntervals (dwr.engine.setRetryIntervals) - An array specifying the default time between retries (in seconds). Defaults to: [ 1, 1, 10 ]
    1. retryIntervals.length - 1 = The number of retry attempts until DWR is offline.
    2. retryIntervals[retryIntervals.length - 1] = The interval used to poll the server while DWR is offline.
    In the default case the first retry will occur in 1 second and the second retry will occur in 1 second - DWR will be offline if both of these retries are unsuccessful. While DWR is offline we will continue to poll for server status every 10 seconds. When DWR goes offline or online pollStatusHandler will be called.
  3. 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.